A total of 32 German soldiers based in Camp Taji near Baghdad were flown by a military transporter A400m to the al-Azraq airforce base in Jordan, the German military said in a statement.
Three German soldiers stationed in Baghdad, the headquarters of the coalition fighting against the Islamic State jihadist group, were transferred to Kuwait.
“These troops can be brought back at any time if the training in Iraq is to resume,” the statement added.
“The safety of our soldiers remains a top priority.
Germany has deployed about 415 soldiers from its Bundeswehr (army) as part of the anti-IS coalition, with about 120 of its troops stationed in Iraq.
The move came after the Iraqi parliament passed a resolution asking the government to end its agreement with the US-led coalition.
A hugely popular figure in the Islamic republic, Qasem Soleimani was killed outside Baghdad airport on Friday in a drone strike ordered by US President Donald Trump, ratcheting up tensions with arch-enemy Iran which has vowed “severe revenge”.
On Tuesday, Iranian lawmakers voted to designate all US forces around the world “terrorists” over Soleimani's killing.
Foreign Minister Heiko Maas said late on Monday the basis for the Germany military presence in Iraq is “that we have an invitation from the Iraqi government and parliament.”
“If that is no longer the case… then the legal basis for us to be there is missing. We have to clarify this with those responsible in Baghdad as soon as possible.”
Chancellor Angela Merkel, France's President Emmanuel Macron and British Prime Minister Boris Johnson had in a joint statement on Sunday urged Iraq to not jeopardize a battle against IS jihadists.
“Preserving the (anti-IS) coalition is of great importance in this context.
“We call on the Iraqi authorities to continue to provide the coalition with the necessary support,” they said.