Deputy government spokesman Thomas Steg said Berlin strongly backed the pledge by US president-elect Barack Obama to shut down the prison at the US naval base in Cuba.
"In our view Guantanamo must be closed on legal and humanitarian grounds, in terms of international law and human rights, and for moral reasons," Steg told reporters.
He said it was the clear responsibility of the United States to find a place for inmates it did not want to accept and who could not be returned to their home countries. But he said Berlin would seriously consider any US request to accept some of them.
"We would need to, and want to, examine this issue when the United States has made clear what its specific plans and timeline are," Steg said. "(But) if we begin to review such closure plans and take a stance, then it can only be in a European context based on a discussion with all member states," he said, adding that Germany would reject any "side deals, swaps or conditions" put forward by Washington linked to handing over prisoners.
In a letter to European Union counterparts this month, Portuguese Foreign Minister Luis Amado said the EU should help the United States close Guantanamo by taking in detainees from third countries.
Foreign Minister Frank-Walter Steinmeier has ordered ministry officials to begin preparing for a possible request to take in former Guantanamo prisoners, his spokesman Jens Ploetner said, adding that German officials met with human rights activists and lawyers for detainees last month.
"Efforts to close Guantanamo must not be allowed to fail" because of difficulty finding countries to accept former inmates, Plötner said. The German government's top human rights official, Guenter Nooke, launched a debate here last week when he called for Berlin to take in some of the 17 ethnic Uighur Chinese held at Guantanamo.
The Muslim group has been in limbo at Guantanamo - despite being cleared for release by the US government - because officials cannot find a country willing to take them.
The men cannot be returned to China because of fears they would be tortured there as political dissidents, US officials say.
Steg said there were no German inmates at Guantanamo. Germany in August 2006 took back Turkish national Murat Kurnaz, who had been held at Guantanamo since January 2002 and was born and raised in Germany.
After his return, Kurnaz accused Berlin of rejecting a US offer to release him in 2002 despite its vocal opposition to the Guantanamo jail. He has also said he was beaten by German special forces in Afghanistan while he was being held by the US military in late 2001, before his transfer to Guantanamo. The charges were investigated by German authorities but never officially substantiated.
The prison, which currently holds about 250 inmates, was opened in early 2002 at a remote US naval base on the southeastern tip of Cuba as a way of holding detainees beyond the reach of US courts.
Defence Secretary Robert Gates, who will be staying on with the new US administration, said last week that an obstacle to quickly closing the site has been getting countries to take prisoners who are no longer considered a threat.
Rights groups have called on EU countries to offer asylum to former detainees.