Berlin: A German aid worker kidnapped in Afghanistan in April is free and safe, the German Foreign Ministry said on Friday.
"Foreign Minister (Frank-Walter) Steinmeier is relieved that a German man who was abducted in mid-April has been free since last night," the spokeswoman told reporters.
"He is doing well under the circumstances and is in the custody of the German consulate in Mazar-i-Sharif" in northern Afghanistan, she added.
The German development agency GIZ, the man's employer, also confirmed he was free.
Meanwhile, an Afghan official said the man had been liberated by security forces.
"He was rescued in a police operation at 3:00 am early Friday," Abdul Wadood Wahidi, the spokesman for the Kunduz provincial governor, told a news agency.
He did not offer any details about the operation.
The German Foreign Ministry spokeswoman also declined to provide further information on the case, which was kept quiet during the hostage's captivity, but said a German crisis team had been working to secure his release.
Steinmeier also discussed the case with Afghan President Ashraf Ghani in early May.
"The German government wishes to thank the Afghan government and the Afghan security forces for their full support in Kabul and Kunduz (the northern province where the aid worker was taken)," the spokeswoman said.
Asked whether a ransom had been paid, she reiterated the standard German position: "The government does not allow itself to be blackmailed."
There has been an increase in kidnappings by militant groups in Afghanistan this year.
Earlier this month, Kabul was able to secure the release of 19 out of 31 mostly Shi'ite Afghans kidnapped by gunmen in the southern part of the country in early February in what was reported to be a prisoner swap.
Late last month, hundreds of Taliban militants came within six kilometres (four miles) of Kunduz city just hours after the insurgents launched their annual spring offensive, in the most serious threat to any provincial capital since the US-led 2001 invasion of Afghanistan.
The insurgents have since been pushed back after Afghan reinforcements were brought in from other frontlines, but the fighting continues to rage on the fringes of the city.
Tens of thousands of people have been displaced due to the clashes, with aid agencies warning of dire living conditions for those who have fled their homes and moved to the city centre.