Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

KABUL, Afghanistan — Three gunmen and suicide bombers stormed a compound housing a foreign NGO in the Afghan capital on Saturday, exchanging fire with security forces before leaving three hostages dead. Six other hostages were rescued after the afternoon attack, police spokesman Hashmat Stanekzai said.

The bloodshed began around 4 p.m. local time, when a grenade was lobbed at the gate of the foreign compound, after which the militants stormed the building in the upscale neighborhood of Karte Seh, police told NBC News. The men were carrying machine guns, grenades and wearing suicide vests.

In the course of the siege, another bomb exploded inside the building, injuring a member of the Afghan special forces, said Kabul's police chief, Gen. Mohammad Zahir Zahir.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

Some of the hostages were rescued once Afghan security forces arrived, but three — two foreigners and one Afghan staffer — were killed, police said. The nationalities of the foreigners weren't immediately known, but the NGO is described as run by South Africans.

A Taliban spokesman said in a statement that it was targeting “a secret Christian missionary and foreign invaders' intelligence center.”

Omid Haqbin, 26, who lives a few streets away from the guesthouse, said he heard three initial blasts and then persistent shooting and sounds of sirens. “It is very scary — just like war,” the web developer told NBC News by telephone as firing was heard in the background. “Oh my God, this is not good — I haven’t heard this much firing in my whole life.”

Shopkeepers closed their stores and security forces in armored cars flooded the street outside his home, Haqbin said.

The attack capped off an especially violent week for the capital as insurgents stepped up their attacks ahead of the departure of a majority of foreign troops from Afghanistan.

IN-DEPTH

The Associated Press contributed to this report.