A suicide car bomber and Taliban militants disguised in burkas attacked a compound housing hundreds of foreigners in the Afghan capital Kabul, killing seven people, officials said.
The Taliban said the attack was a response to US president Barack Obama's surprise visit hours earlier.
At least 17 people were wounded in the assault, most of them Afghan children on their way to school, the interior ministry said.
The attack started around 6am in eastern Kabul with a series of explosions and gunfire ringing out from the privately guarded compound known as Green Village that houses hundreds of international contractors.
Shooting and blasts continued for hours as militants who had stormed into the compound held out against security forces. The area appeared to have calmed down by about 10am and Nato said all the attackers had been killed.
The gate at the entrance of the Green Village was destroyed, with the wreckage of the suicide bomber's car in front.
The suicide car bomb that exploded near Jalalabad Road - one of the main thoroughfares out of the city - was among the first blasts in the attack, said interior ministry spokesman Sediq Sediqi. A car that was driving past was caught in the explosion and four people inside were killed, Mr Sediqi said. A passer-by and a Nepalese security guard were also killed, said Kabul deputy police chief Daoud Amin. The seventh death was not identified.
The explosions happened hours after Mr Obama left Afghanistan following a quick visit to mark the first anniversary of Osama bin Laden's death. He spoke to troops and signed a pact with Afghan president Hamid Karzai to govern the US presence in Afghanistan through to 2024.
Taliban spokesman Zabiullah Mujahid claimed the attack and said it was planned as a response to Mr Obama's visit. However, because such complex attacks usually take significant advance planning, it is also possible that the Taliban was capitalising on fortunate timing.
The Taliban later announced its annual "spring offensive" would begin on Thursday. The offensive comes every year as the snows melt, making both travel and fighting easier as the Taliban try to retake lost territory and intimidate the Afghan government.