Madrid: The Spanish government said Saturday a Taliban attack on the diplomatic quarter of the Afghan capital Kabul, in which two Spanish policemen were killed, was "an attack on Spain."
The death toll, at least six according to reports from Kabul, was not clear Saturday.
Afghan officials said four Afghan police officers were killed.
The Spanish government said two local embassy workers were also killed in the attack as Taliban fighters laid siege to a guesthouse popular with foreign visitors near the embassy compound.
"We are dealing with a terrorist attack, in which two Spanish citizens died and our interests were severely undermined. This is therefore, an attack on Spain and its cooperation in the strengthening of democracy in Afghanistan," the government in Madrid said in a statement after the siege ended early Saturday.
"The investigation is ongoing and no assumptions have been ruled out," statement added.
The Taliban has claimed responsibility for the attack, which began when a huge car bomb struck the heavily-guarded district during rush hour on Friday evening.
Multiple blasts and gunfire were heard over the course of the night.
Fraidoon Obaidi, the head of Kabul`s Criminal Investigation Department, said four attackers were killed in the "terrorist attack".
In a statement the Taliban said their target was the guesthouse, which is popular with foreigners, and made no mention of the Spanish embassy.
The Spanish government said three Taliban fighters burst into the embassy after the car bomb blew off the gate of the compound, triggering a gunbattle that lasted over an hour.
The first policeman was killed in the car bomb, with the second dying later in hospital of injuries sustained in the attack, Madrid said.
The attack came hours after President Ashraf Ghani voiced optimism that a peace process with the Taliban would resume within weeks.