A suicide car bomber has attacked Germany's consulate in northern Afghanistan, killing four people and wounding more than 100.
Four dead - two civilians and two unidentified bodies - were taken to the Balkh hospital, said Dr Noor Mohammad Faiz.
He said 128 people were wounded in the attack.
"The blast was too loud and powerful, which shattered windows, and many civilians were wounded inside their homes," he said.
The car exploded at the gate of the consulate in the city of Mazar-i-Sharif, destroying the gate and wall at about 11.10 pm on Thursday, said Abdul Raziq Qaderi, head of security for Balkh province.
The blast destroyed the Mazar Hotel, where the consulate is based, and surrounding buildings. Residents said that casualties were contained because it was late, though an ensuing gun battle raged for around five hours.
President Ashraf Ghani called the attack a "crime against humanity and all international laws".
The Taliban claimed responsibility.
Germany's foreign ministry said all consulate employees were safe and unhurt after the attack.
It said "heavily-armed assailants" were beaten back by consulate security staff, Afghan security forces and international troops based in Afghanistan as part of Nato's Resolute Support mission.
Many houses and shops were destroyed or damaged, said Munir Ahmad Farhad, spokesman for the provincial governor in Balkh.
"The security situation is under control right now," Mr Farhad said, adding: "There are many women and children among the wounded."
Germany has 983 soldiers stationed in Afghanistan, most of them in Balkh province, as part of the Nato mission. Mazar-i-Sharif is the provincial capital and one of the richest and most important cities in Afghanistan.
The Taliban's insurgency has spread from their southern heartland across the country in the past two years, following the withdrawal of most international combat troops. Attacks across the north have been increasing.
The Taliban statement from spokesman Zabihullah Mujahid said the attack was retaliation for recent airstrikes in the northern city of Kunduz, capital of the province of the same name.
A US airstrike earlier this month killed dozens of people and is under investigation.