“It is the right thing to do and we have been requesting for some time that the end of operations there be based on realities on the ground,” a government spokeswoman said.
“It is our common goal that no more terror attacks are planned on Afghan soil.”
On Monday Trump announced a reversal of his own previous stance that the US should withdraw its military from Afghanistan after 16 years of fighting the Taliban.
Washington is expected to send an additional 4,000 soldiers to the country, bringing the US troop presence to over 8,000 soldiers.
In 2016 Germany strengthened its own deployment in Afghanistan to 18 percent higher than the number agreed among NATO members. There are currently 980 German soldiers in the south Asian country. Afghanistan also receives more in German aid than almost any other country across the globe.
Berlin said on Tuesday that the government in Kabul needs to push through a programme of reforms, do more to tackle corruption and enter dialogue with the parts of the Taliban which are prepared to come to a peaceful compromise.
Defence Minister Ursula von der Leyen also welcomed the decision but said that Germany would not follow suit by further raising its troop numbers.
Foreign Minister Sigmar Gabriel meanwhile said that “we expect the US to agree on action in close cooperation with Europe."
He said that a stable Afghanistan was also in Europe's interest, as conflict in the country has pushed Afghans to seek asylum in the EU.
“More migration destabilizes Europe as well as Afghanistan,” he said.
But the Green Party criticized Trump’s new strategy.
“Now Trump wants to put his foot on the gas in Afghanistan. That is the stupidest thing that he can do,” said Jürgen Trittin, the Green party’s foreign affairs spokesman.