Taliban militants attacked a foreign compound in Kabul on Saturday, killing two employees in the latest strike to hit the Afghan capital during the final weeks of NATO's 13-year war against the insurgents.
One Afghan and one foreigner were killed, officials said, but they declined to identify the foreigner's nationality or the targeted organisation.
The US-led NATO combat mission in Afghanistan will end on December 31 and be replaced by a follow-on mission supporting the Afghan army and police, who have taken over responsibility for thwarting the Taliban.
NATO troop numbers, which peaked at 130,000 in 2010, will fall to about 12,500 next year, with fears growing that the declining international presence is already fuelling the Islamist insurgency.
A three-day stand-off at Camp Bastion, a major army base in the south that was handed over by NATO forces last month, also ended on Saturday after insurgents who got into some empty barracks were finally shot dead.
The recent rise in violence has undermined NATO claims that Afghanistan is a stable state as troops pull out.
"One Afghan and one foreigner, both working for a foreign organisation, were killed," Hashmat Stanakzai, Kabul police spokesman, told AFP as elite commandos cleared the site in west Kabul after three hours of fighting.
"Three suicide bombers targeted this building," he said. "The Afghan security forces quickly reached the site of the attack, and started operations against them.
"Fighting was over after three hours, with all three militants killed. Six people were rescued."
Government officials told AFP that the compound, near the Afghan parliament, was used by a small foreign relief organisation.
Taliban spokesman Zabiullah Mujahid claimed on Twitter that it was a secret Christian missionary and that a meeting of Australian visitors had been hit.
"A spate of deadly martyrdom attacks have rocked important enemy targets in recent days," Mujahid added.
Kabul has been hit by at least nine attacks in the last two weeks, with targets including US military convoys, security contractor compounds and a female Afghan member of parliament.
Saturday's attack came two days after the Taliban struck at another foreign guesthouse, wounding a guard, and a suicide bomber targeted a British embassy vehicle in a blast that killed six people.
In the latest attack, gunmen wearing suicide vests stormed the building apparently looking for foreigners. A neighbouring building was engulfed in flames as security forces hunted down the militants.
The attack against Camp Bastion in the southern province of Helmand started on Thursday evening and was finally repelled on Saturday, military officials said, adding that militants had got inside the base and holed up in barracks.
At least five Afghan soldiers died in the fighting, as well as 26 insurgents, Ghulam Farooq Parwani, a senior Afghan army commander at the camp, told AFP.
Camp Bastion was a key airfield for US-led NATO operations in the Taliban heartlands of the south.
Afghan soldiers and police have endured soaring casualties on the battlefield with more than 4,600 killed this year as they take on the Taliban with less assistance from the US military.
President Ashraf Ghani, who came to power in September, has vowed to bring peace to Afghanistan after decades of conflict, saying he is open to talks with the Taliban, who ruled Kabul from 1996 to 2001.
Ghani finally emerged as president after signing a power-sharing deal with his poll rival Abdullah Abdullah.
Both men claimed to have won fraud-tainted elections in a stand-off that caused political paralysis in Kabul and fanned worsening violence nationwide.
Britain hosts a major donor conference on Afghanistan next week, which is designed to showcase Ghani's "national unity government" and demonstrate continuing international support for the country.