By Abdul Matin and Sabine Siebold
MAZAR-I-SHARIF, Afghanistan/BERLIN (Reuters) - Taliban militants stormed the German consulate in the northern Afghan city of Mazar-i-Sharif, ramming its outer wall with a truck bomb before battling security forces in an overnight attack that killed at least four people, officials said.
The explosion caused extensive damage to the building, a NATO spokesman said, but Germany indicated on Friday this would not deter it from continuing its work as part of the international mission in Afghanistan.
Triggered by a suicide bomber, the blast shattered windows as far as 5 km (3 miles) away, NATO said. A local doctor said it and the subsequent firefight also wounded 120 people.
Twenty consular staff survived the attack with no injuries, German officials said.
Foreign Minister Frank-Walter Steinmeier said soldiers had had to battle hard to repel the heavily armed attackers.
"It was only possible to ... beat them back after fighting that occurred at the compound and in the building," he said, adding that Berlin would review its lead role in northern Afghanistan.
His spokesman Martin Schaefer later said he did not expect a big policy shift.
"I cannot imagine that the events of last night will lead to a fundamental change in Germany's thinking or that of the global community on the need for continued assistance for Afghanistan," Schaefer told reporters.
The attack also highlights one of the tougher policy challenges facing U.S. President-elect Donald Trump when he takes office in January.
U.S. combat operations against the Taliban largely ended in 2014, but thousands of its soldiers remain in Afghanistan as part of the NATO-led Resolute Support mission.
The Taliban said the attack was in retaliation for NATO air strikes against a village near the northern city of Kunduz last week in which more than 30 people, many of them children, were killed.
Heavily armed fighters, including suicide bombers, had been sent "with a mission to destroy the German consulate general and kill whoever they found there", the Islamist militant movement's spokesman, Zabihullah Mujahid, said by telephone.
Taliban forces came close to over-running Kunduz last month, a year after briefly capturing it in their biggest success in Afghanistan's 15-year-long war.
INTO THE EARLY HOURS
The NATO spokesman said at least one vehicle packed with explosives was rammed into the high outer wall surrounding the consulate, but authorities were investigating if a second car had been involved.
"The extent of damage to the city is huge," said Abdul Razaq Qaderi, deputy police chief of Balkh province. "This kind of an attack, bringing a truck full of explosives and blowing it up in the city, had never happened before.
Noor Mohammad Faiz, the head doctor in Mazar-i-Sharif hospital, said four bodies and 120 wounded, most hurt by flying glass, had been brought to the hospital.
Qaderi said German troops later shot and killed two men on motorcycles who did not comply with orders to stop, with a third man seriously injured. German Defence Minister Ursula von der Leyen said that incident was being investigated.
It was not clear if the men were attackers or civilians.
Germany, which heads Resolute Support in northern Afghanistan, has about 800 soldiers at a base on the outskirts of Mazar-i-Sharif, with another 1,000 troops coming from 20 partner countries.
The explosion occurred about an hour before midnight local time, a spokesman for the German military joint forces command in Potsdam said.
"It was a prepared attack for which we made all arrangements," the Taliban's Mujahid said, adding that dozens of German soldiers and intelligence personnel were killed in the attack.
The Taliban often exaggerate casualties caused by its operations.
Sayed Kamal Sadat, police chief of Balkh province, said the fighting was over by the early hours of the morning after Afghan special forces, German security personnel and NATO's quick reaction protection force intervened.
At least one suspect was arrested from the area of explosion, officials said.
The heavily protected consulate is in a large building close to the Blue Mosque in the center of Mazar-i-Sharif, where the Indian consulate was also attacked by militant gunmen earlier this year.
(Additional reporting by Andrea Shalal in BERLIN, James Mackenzie, Mirwais Harooni and Hamid Shalizi in KABUL, and Jibran Ahmad in PESHAWAR; Writing by Andrea Shalal; Editing by John Stonestreet)