Afghan firefighters douse a burning vehicle in Kabul after a suicide bomb attack. Taliban insurgents claimed a suicide attack in Kabul, shortly after US President Barack Obama left the city after an overnight visit. Photo: AFP/Getty Images

Obama shakes hands with Marine Gen. John R. Allen, commander of the U.S. Forces Afghanistan, before he addresses troops at Bagram Air Field, Afghanistan. (AP)

KABUL — Just hours after President Obama used a surprise visit to Afghanistan to acknowledge for the first time that his administration has been in direct talks with the Taliban, the group launched a deadly attack on a fortified guesthouse used by Westerners in Kabul on Wednesday morning.

Seven people — most of them civilian children — were confirmed dead after the burqa-wearing terrorists detonated a suicide car bomb then traded small arms fire with guards.

The target was the “Green Village” used by international organizations, including the European Union and the UN, Afghan interior ministry spokesman Sediq Sediqqi told AFP.

The Taliban claimed responsibility for the assault and said it was a riposte to Obama, who had earlier signed a new partnership pact set to govern Afghan-US relations after 2014.

The US embassy in Kabul sounded its alarm as the attack began with explosions and gunfire, writing on its Twitter page, “Duck and cover here at the embassy. Not a drill — avoid the area.”

NATO’s International Security Assistance Force (ISAF) released a statement later, saying that Afghan security forces “led a capable and quick response” that resulted in the deaths of all the Taliban attackers. It was not clear how many terrorists died.

ISAF said the majority of those killed in the attack were Afghan children from a nearby school.

“This is another desperate attack by the Taliban, but again another noteworthy performance by Afghan Security Forces for taking the lead in putting down another desperate attack by insurgents,” said Gen. Carsten Jacobson, ISAF spokesman.

“[It was] another attack by the insurgency that resulted in the deaths of innocent Afghan civilians, with most of that being children from a nearby school.”

The assault came two weeks after one of the largest attacks in Kabul, where squads of militants targeted government offices, embassies and foreign bases more than 10 years after the Taliban was driven from power for refusing to hand over al Qaeda chief Usama bin Laden.

It occurred less than two hours after Obama flew out of Afghanistan, with his visit making headlines around the world.