A German engineer and four Afghans taken hostage in July were freed Wednesday in exchange for six Taliban fighters, an Afghan official said.

Rudolf Blechschmidt and the four Afghans were handed over by local elders to officials from Afghanistan's intelligence service in the Jaghato district of Wardak province, said the district chief, Mohammad Nahim.

Five detained Taliban militants had been freed in the swap, he said.

In Germany, Foreign Minister Frank-Walter Steinmeier confirmed that Blechschmidt had been freed, and the former captive told Spiegel magazine on his release that he was "doing well."

"I'm just a little tired," he told the magazine in a short telephone interview posted on its Web site.

Blechschmidt had also talked with the German ambassador by telephone and confirmed he was safely in the custody of Afghan security forces, Steinmeier said in a statement.

"We are all pleased and relieved," Steinmeier said.

The release comes just two days after Blechschmidt appeared on a new videotape, appealing to Afghan and German governments to make a deal with the militants for his release before winter.

Blechschmidt said in the video that he was in poor health but that an Afghan doctor had helped him.

Blechschmidt is one of two German engineers and five Afghans taken hostage on July 18 in Wardak province in central Afghanistan. The other German was found dead of gunshot wounds on July 21, while one of the Afghans apparently managed to escape.

Four Red Cross employees were taken hostage by the Taliban on Sept. 27 while trying to win the German's release. The four were released in good health two days later.

On the video, Blechschmidt said the German Embassy had refused to engage in talks for a time, but that negotiations had restarted recently and that "we hope we will become free."

Kidnappings by Taliban militants and criminal gangs have risen in Afghanistan in recent months. A series of high-profile kidnappings have led to ransom payments and prisoner releases, apparently fueling the rise in the abductions.