Fighting was reported outside and in the compound after the blast but was brought under control by Afghan and NATO forces. According to initial reports, two people were killed in the attack which took place in Mazar-e-Sharif, north of Afghanistan.
Militants attacked the German consulate in the northern Afghan city of Mazar-e-Sharif late on Thursday, ramming a car packed with explosives into its high outer wall. Afghan officials say several civilians have been killed and scores wounded.
A German Foreign ministry spokesman reported fighting outside and in the compound of the German consulate after the blast. Consulate personnel have been evacuated, according to local officials.
Sayed Kamal Sadat, police chief of Balkh province, said Afghan special forces were still conducting search operations but were not encountering any more resistance, he said. The area would be locked down until morning when the search would continue after daybreak.
#AFG An Afghan CDR Mazar-E Sharif , "Wall&gate for German consulate destroyed in attack. Afghan forces will stay in area until morning."— BILAL SARWARY (@bsarwary) November 10, 2016
The German Foreign ministry spokesman said Afghan security and NATO forces were now on site and Foreign Minister Frank-Walter Steinmeier was receiving continual updates on the situation. The ministry had convened a crisis task force, the spokesman added.
The bombing was claimed by the Taliban in retaliation for NATO air strikes last week near the northern city of Kunduz, German broadcaster Deutsche Welle said. The air strikes left up to 32 civilians dead.
A NATO spokesperson said there was a likelihood two car bombs were involved. "There are massive damages to the consulate," the spokesman said.
The local city hospital received two bodies, said Noor Mohammad Fayez, the head doctor. There was no immediate report on whether consulate staff were among the dead or wounded. Hospital officials told TRT World at least 90 were injured in the attack.
"The suicide attacker rammed his explosives-laden car into the wall of German consulate in the city," Sadat said.
Afghan special forces cordoned off the area as helicopters were seen flying over the consulate and ambulances with wailing sirens rushed to the area.
Sporadic gunfire rattled the usually tranquil city after the huge explosion, which smashed windows of nearby shops and left terrified local residents fleeing for cover. A nearby market selling carpets was set alight.
The impact of the blast shattered windows within a two-kilometre radius, a local told TRT World. The city went into semi-lockdown as security forces "were everywhere".
Hamid Rasooli, a resident of Mazar-e-Sharif, said, "It was around 11pm, I was in my room getting ready to go to bed when a huge explosion rocked our building." He added, "My windows shattered. I was scared and ran outside – people were screaming in my building."
Rasooli said smoke could be seen mushrooming over Darwaza-e-Balkh, two kilometres from our house, where the German consulate is located."
Another local, Imran Khan said, "It was a very powerful blast, I've never heard such a strong explosion." Imran first thought it was an earthquake because shattered window panes were falling everywhere. "The blast was so huge, I felt it could have been inside my building."
He said, "My room went dark; I tried to go outside—we all did—but then the firing started. Small and heavy guns could be heard near Darwaza-e-Balkh."
NATO in Afghanistan
NATO forces have a large base on the edge of the city.
Germany, which is responsible for the NATO presence in northern Afghanistan, has about 1,000 soldiers at the base, with another 1,000 troops coming from 20 partner countries.
A spokesman for NATO forces in the area said troops from the North Atlantic alliance had been sent to the scene.
The explosion occurred at around 2305 local time, a spokesman for the German military joint forces command in Potsdam said.
US embassy warns of possible attacks in Tajikistan
The United States embassy in Tajikistan said on Thursday it had received information about possible attacks on large public gatherings in the Central Asian nation and its border crossings with Afghanistan.
The embassy said in a statement that "terrorist groups" may carry out such attacks, but did not name them. It urged US citizens to avoid large crowds and public transportation.
The impoverished, mostly Muslim nation often reports clashes with Afghan drug smugglers along the border.
The former Soviet republic is also planning a series of events in parks and other public places to mark a new holiday, President's Day, on November 16.
President Imomali Rakhmon, in power since 1992, faced a coup attempt by a senior defence official in September 2015. His government has since banned an religious party, once the country's main opposition.
This is a developing story and will be updated accordingly.