Afghan security forces have fought Taliban insurgents for hours in the centre of Kabul, after a major explosion shook the city.
A Nepali guard and an off-duty policeman were killed, along with a number of militants.
The attack hit a guesthouse used by the International Organization for Migration, one of whose employees was badly injured.
The Taliban told the BBC it was targeting CIA trainers.
The attack began at about 16:00 local time (11:30 GMT) with a car bombing, and it was late evening in Kabul by the time interior ministry spokesman Sediq Sediqqi said the last of the assailants had been killed.
The militants, who officials said numbered five or six, had been holed up in the area, home to a number of buildings used by foreign workers.
“We are dealing with a well co-ordinated attack,” Kabul police chief Gen Ayub Salangi told the BBC as the attack unfolded.
He said seven policemen had been injured.
A Taliban spokesman said the group had targeted CIA trainers instructing Afghans at the National Directorate of Security (NDS) intelligence agency.
The IOM, which is affiliated to the UN, said three of its employees had been injured, one of them seriously burned by a grenade. An employee of the International Labour Organization was also wounded.
It was not clear whether the guesthouse used by the IOM employees was the Taliban’s main target.
UN special envoy Jan Kubis strongly condemned the attack, and said all UN staff had been accounted for.
During the assault, Afghan TV Channel One quoted police as saying a group of militants had taken up position inside the nearby headquarters of the Directorate of the Afghan Public Protection Force (APPF).
A hospital run by the NDS is also in the area.
The initial explosion was felt several kilometres away, shattering shop windows and sending a plume of smoke into the sky. There were reports of smaller, subsequent blasts.
Graeme Smith, who works for the think tank Crisis Group and lives in the New City neighbourhood about 1km (0.6 miles) away from the site of the fighting, said he had heard a constant exchange of gunfire for several hours.
“It seems to have been contained, which shows how robust the Afghan forces are in the capital,” he said.
“In more rural parts of the country this would have had a much bigger impact.”
The Taliban announced a “spring offensive” in April, saying it would target foreign military bases and diplomatic areas.
Last week another Islamist militant group, Hezb-e-Islami, said it had carried out an attack on a military convoy in Kabul in which at least 15 people were killed and dozens injured.
In the last major attack in Kabul before that, a suicide bomber blew himself up near the defence ministry, killing nine people.
Most international troops are scheduled to leave Afghanistan by the end of 2014. Afghan forces are due to take responsibility for the security of the whole country in the next few months, for the first time since 1992.