KABUL – Taliban fighters attacked a detachment of German troops Friday who were on a bridge-building and mine-clearing mission, triggering a gunbattle that left three soldiers dead, the German Defense Ministry said. Five other Germans were wounded in the fighting southwest of Kunduz city, the ministry said. German troops and Afghan police exchanged fire with their attackers for about an hour, with fighting resuming three hours later, local government chief Abdul Wahid Omar Khil said. He estimated there were about 200 Taliban militants involved in the engagement. One Taliban fighter was killed and another was wounded, but the Germans and Afghan police were unable to use heavy firepower because the militants were firing from inside and on top of civilian homes, Omar Khil said. Kunduz provincial police Chief Gen. Abdul Razaq Yaqoubi said the battle began after a mine exploded under a German armored vehicle. He said the troops were preparing to build a bridge and clear mines in the Chahar Dara area, about eight miles (12 kilometers) from the provincial capital. Berlin has more than 4,000 troops in Afghanistan — the third largest foreign troop contingent in the country — as part of the NATO presence fighting the Taliban and seeking to establish central government authority. German forces control much of the country's north, which is relatively peaceful. The surroundings of Kunduz, however, have recently proven increasingly volatile.