An Afghan official says the German consulate in the northern Afghan city of Mazar-i-Sharif has come under attack.

Sher Jan Durrani, the spokesman for the police chief of Balkh province, said on Saturday a gun battle is going on at the consulate.

The Taliban issued a statement saying they had sent suicide attackers to the consulate.

Walter Hassmann, the German ambassador to Afghanistan, says the "incident is ongoing" and provided no further details.

Residents in the city reported hearing a huge explosion near the consulate which shattered windows in buildings nearby.

Germany has 938 soldiers stationed in Afghanistan, most of them in Balkh, as part of NATO's Resolute Support mission.

The Taliban's insurgency has spread from their southern heartland across the country in the past two years.