Chancellor Angela Merkel made an unannounced visit to Afghanistan on Friday to shore up morale among Germany's 4,200 troops as foreign forces withdraw after more than a decade of fighting.
The war is increasingly unpopular in Germany, but Merkel told troops in Kunduz province that political and economic progress was being made and that their contribution was making a difference.
"Progress is sometimes difficult, sometimes it is slower than we would like but it is essential that our military involvement is not seen in isolation and that it is a success," she said.
Germany, which has the third-biggest troop deployment in Afghanistan after the United States and Britain, has cut numbers from 5,000 as the NATO pull-out gathers pace ahead of the end of the mission next year.
Merkel arrived in the northern city of Mazar-i-Sharif and made a short trip to nearby Kunduz.
"She is here to support the troops, to attend briefings and to address concerns after our recent loss," a military spokesman told AFP, referring to the death last Saturday of the first German soldier to be killed in Afghanistan in two years.
Germany is the NATO coalition's "lead nation" across nine provinces in northern Afghanistan, a relatively peaceful area compared to the insurgency hotbeds in the south and east.
However the German special forces soldier was shot dead when insurgents opened fire on a joint Afghan-German operation in Baghlan province.
Merkel earlier condemned it as a "terrorist attack".
Contributors to the NATO force such as Germany are weighing up how to schedule their withdrawal from Afghanistan by the end of 2014 while leaving behind a competent Afghan army and police force.
Last month Germany offered to keep 600-800 troops in Afghanistan for two years from 2015 to help further train and advise the security forces in their battle against the Taliban.
Washington said Thursday that US troops will stay in Afghanistan after 2014 "only at the invitation" of the Afghan government, after President Hamid Karzai revealed that the US could keep nine bases open across the country.
"The United States does not seek permanent military bases in Afghanistan," White House press secretary Jay Carney told reporters.
"Any US presence after 2014 would only be at the invitation of the Afghan government and aimed at training Afghan forces and targeting the remnants of Al-Qaeda."
The size of the "residual" US force has not been agreed, with numbers ranging from 2,500 to 12,000, according to US officials, as Washington scales down the long war that began after the 9/11 attacks in 2001.
The NATO force currently consists of about 100,000 troops, of which 66,000 are from the US.
Merkel travelled to Afghanistan with Defence Minister Thomas de Maiziere, a German government spokesman said without giving further details of her itinerary.