Taliban bombers attacked a heavily fortified guesthouse used by Westerners in Kabul on Wednesday and announced the start of their annual "spring offensive", defying calls from visiting US President Barack Obama about ending the war.
Seven people were killed after attackers disguised in burqas detonated a suicide car bomb and clashed with guards at the "Green Village" complex used by the European Union, the United Nations and aid groups, officials said.
The assault raises fresh concern about the resilience of the insurgency on the anniversary of Osama bin Laden's death as NATO winds down its combat presence in the next two years and hands over responsibility for security to Afghan forces.
The Taliban said the assault was a riposte to Obama, who just hours earlier signed a new partnership pact in Kabul to govern Afghan-US relations after 2014 -- a deal the insurgents dismissed as "illegitimate".
In an election-year address, Obama presented himself as a commander-in-chief capable of ending two long wars, following the US withdrawal from Iraq, and crushing Al-Qaeda, and tried to conjure up a new dawn for a US public exhausted by conflict and recession.
"This time of war began in Afghanistan, and this is where it will end," Obama said, recalling a decade-long "dark cloud of war" after bin Laden plotted the September 11 attacks in 2001.
"Yet here, in the pre-dawn darkness of Afghanistan, we can see the light of a new day on the horizon," said Obama, seeking a second White House term later this year.
Obama flew into Kabul in secret in the dead of night and signed the deal with President Hamid Karzai, cementing 10 years of US aid for Afghanistan after NATO combat troops leave in 2014. Most Afghans were asleep and he left after about six hours.
"We look forward to a future of peace. We're agreeing to be long-term partners," Obama said at Karzai's palace.
The Taliban said Karzai had no right to sign the deal and accused him of selling Afghan sovereignty to the Americans.
The Green Village assault began around two hours after Obama left.
Police said suicide attackers wearing burqas struck at 6:15 am (0145 GMT), detonating a car bomb before clashing with guards. The interior ministry said seven people were killed, including at least six Afghans.
There were three attackers, the ministry said, one in the suicide car bomb and two who got inside the complex. One blew himself up while the other was shot dead by security forces.
Mangled bodies were seen lying in the road after the attack, which left two vehicles completely destroyed and blew out the windows of a nearby school.
Health ministry spokesman Kargar Noorughli said 18 people were wounded and eight admitted to hospital.
Taliban spokesman Zabiullah Mujahid told AFP the attack was a message to Obama to say the militants would continue to fight until all foreign forces had left.
The militia said its spring offensive, code-named Al-Farouq, would from Thursday target "foreign invaders, their advisors, their contractors, all those who help them militarily and in intelligence".
Just over two weeks ago, one of the largest attacks in Kabul targeted government offices, embassies and foreign bases.
The White House said the pact allows the possibility of American forces staying behind to train Afghan forces and pursue the remnants of Al-Qaeda for 10 years after 2014.
The deal was concluded just over two weeks before a NATO summit in Chicago, but does not cover the crucial issue of the status and immunity from prosecution in local courts of any US troops remaining in Afghanistan.
Instead it commits Washington to specific troop or funding levels for Afghanistan, though is meant to signal that despite ending the longest war in US history, Washington intends to ensure Afghanistan does not revert to a haven for terror groups.
Karzai said the US pact was no threat to any third country and he hoped it would lead to stability in the region.
But US ambassador to Kabul, Ryan Crocker, suggested the pact does not necessarily preclude drone strikes on insurgent targets in Pakistan after 2014.
"There is nothing in this agreement that precludes the right of self-defence for either party and if there are attacks from the territory of any state aimed at us we have the inherent right of self defence and will employ it," he said.
Crocker was responding to a question about controversial drone strikes on Taliban and Al-Qaeda targets in Pakistan at a briefing.
A Pentagon report on Tuesday warned that insurgent sanctuaries in Pakistan and corruption posed "long-term and acute challenges".
The Afghan war has cost the lives of nearly 3,000 US and allied troops, thousands of Afghans and hundreds of billions of dollars.
US troops could be fighting for two more years, and some could remain in danger for a decade after that.
Obama bluntly told US soldiers that "some of your buddies are going to get injured, some of your buddies may get killed".
About 87,000 US troops and 44,000 other international forces are deployed in Afghanistan along with 344,000 Afghan army and police.