Germany's consulate in northern Afghanistan was attacked when a suicide car bomber rammed the compound, killing six people and wounding more than 120, Afghan police and the German foreign minister said Friday.

Four of the dead — two civilians and two unidentified bodies — were brought to the Balkh hospital, said Dr. Noor Mohammad Faiz. He said 128 people were wounded in the attack.

Germany's Foreign Minister Frank-Walter Steinmeier said six people had been confirmed dead. He added in a statement that "all German and Afghan employees of the consulate remained unharmed."

The car exploded at the gate of the consulate in the city of Mazar-i-Sharif, destroying the gate and wall around 11.10 p.m. 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 of the late hour, though an ensuing gun battle raged for around five hours.

More on this...

Steinmeier said fighting took place "on the premises and inside the consulate."

The attack was carried out "by heavily armed terrorists," he said, adding: "The attackers were fought off by the consulate's security personnel, Afghan security forces, and German, Georgian, Belgian and Latvian special forces stationed in the city as part of the Resolute Support mission."

President Ashraf Ghani called the attack a "crime against humanity and all international laws."

The United Nations' assistance mission in Afghanistan also condemned the attack. In a statement it said the injured include 19 women and 38 children.

"Most of the injured suffered minor wounds from broken glass while those with serious injuries remain hospitalized," it said. More than 100 homes and shops were damaged, it said.

The Taliban claimed responsibility.

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 U.S. airstrike early this month killed dozens of people and is under investigation.