The German military late on Tuesday concluded its withdrawal from Afghanistan after almost two decades. 

Reuters says It was in Afghanistan that Germany's military fought the first ground battles since the end of World War II.

U.S. President Joe Biden and NATO announced in mid-April that they would pull out the roughly 10,000 foreign troops still in Afghanistan at the time by Sept. 11, the 20th anniversary of the attacks on the World Trade Center in New York that prompted the mission.

Over the last years, Germany reportedly had the second largest contingent of troops after the United States in Afghanistan, with around 150,000 soldiers deployed over the past two decades, many of them serving more than one tour in the country.

According to Reuters, fifty-nine German soldiers died in Afghanistan, 35 of them killed in combat or as a result of militant attacks, making it Germany's deadliest military mission since World War 2.

Wrapping up the operation, Germany said it would have to redeploy the equivalent of around 800 containers of equipment such as armored vehicles, helicopters, weapons and ammunition as the drawdown began.

The multinational camp in northern Mazar-e Sharif led by Germany had been reinforced with troops and mortars, ramping up security for the duration of the withdrawal to guard the base against attacks by the Taliban.

"Our last troops left Afghanistan this night after almost 20 years and are on their way home," German Defense Minister Annegret Kramp-Karrenbauer said in a statement, according to Deutsche Welle (DW). 

"This marks the end of a historic chapter – an intense deployment that has challenged and shaped us," she wrote on Twitter.

She thanked the soldiers for fulfilling their duties in Afghanistan "with professionalism and conviction."

The end of Germany's Afghanistan mission comes as the Taliban in Afghanistan rapidly seize new territory from the US-backed government in Kabul.  Taliban forces are also positioning themselves around provincial capitals, prompting fears that they will seize full control once all foreign troops leave.  The UN reported a spike in civilian casualties since last September.