KABUL (Reuters) - Afghan security forces suppressed a suicide attack on a guest house attached to the Spanish embassy in Kabul, killing three Taliban fighters after hours of intermittent gunfire and explosions that lasted into the early hours of Saturday.

Two Spanish security officers and four Afghan police were also killed in the attack, in a heavily protected part of Kabul close to several embassies and government buildings, Kabul police spokesman Basir Mujahid said.

In Madrid, the Spanish government said all other embassy staff had been evacuated from the site and were receiving treatment.

In addition, nine Afghan civilians were wounded and another 47 Afghans and foreigners were rescued from nearby buildings where they were trapped as security forces sealed off the area around the guest house, which guards at the site said formed part of the Spanish embassy compound.

The latest in a series of attacks on foreign targets in Kabul began at about 6 p.m. on Friday when a suicide attacker detonated a car bomb near the guest house, allowing three gunmen to take up positions and open fire on security forces.

“The operation took time because we wanted to rescue the people trapped in surrounding buildings and we had to move cautiously and in a proper tactical manner,” Kabul police chief Abdul Rahman Rahimi told Reuters after the operation ended at around 5.30 a.m.

The Taliban claimed responsibility for the attack on the “invader’s guest house”, just days after President Ashraf Ghani returned from a regional peace conference in Pakistan, where he sought support to revive peace talks that stalled this year.

Slideshow ( 3 images )

Ghani’s government has come under increasing pressure as the Taliban insurgency, aimed at expelling foreign forces and bringing down the Western-backed government, has spread since NATO ended its combat mission last year.

The head of the intelligence services, who strongly opposed Ghani’s bid to involve Pakistan in the peace process, resigned on Thursday, underlining divisions in the national security apparatus.

In a statement issued on Saturday, the Taliban taunted authorities with the “shame and humiliation” of not being able to prevent an attack in the heart of the capital.

“The presence of our Mujahideen with weapons and a car loaded with explosives in such a high security area shows God’s support and the cooperation of the poor and Muslim people,” spokesman Zabihulla Mujahid said in a statement.

The Islamist movement has been racked by internal power struggles of its own with rival factions battling for supremacy since it confirmed in July that its founder, Mullah Mohammad Omar, had died more than two years previously.

However, that has not prevented the militants from gaining a string of successes, including the brief seizure of the northern city of Kunduz in September.

Friday’s attack followed a separate Taliban attack on the airport complex in the southern city of Kandahar, in which at least 50 civilians and security forces personnel were killed.