Afghan security forces members inspect the site of a car bomb attack in Kabul May 2, 2012. At least six people were killed in the suicide car bomb attack in the Afghan capital on Wednesday, officials said, hours after U.S. President Barack Obama left Kabul following an unannounced visit during which he signed a strategic partnership agreement. REUTERS/Omar Sobhani

A suicide car bomb attack carried out by the Taliban militants in the Afghan capital of Kabul Wednesday, within hours of US President Barack Obama's surprise visit, has killed six persons and left several injured.

Taliban insurgents, dressed in full length veils and accompanied by a car bomber, attacked a compound housing hundreds of foreigners in Kabul in the early morning hours Wednesday. The initial car bomb blast was followed by a series of grenade attacks and hours of shooting, the Associated Press reported.

A vehicle stopped here and six individuals wearing burqas entered the alley carrying black bags in their hands, an eyewitness Abdul Manan told the Associated Press. When they entered the alley, explosions happened, and I escaped from the area.

Hundreds of security personnel surrounded the area around blast-hit Green Village, soon after the attacks. Officials said none of the attackers was able to enter the heavily guarded complex.

However, Taliban's Mujahid claimed that the militants were able to breach the security to enter the compound, and inflicted casualties.

A spokesman for the NATO-led coalition force said the attack had been contained.

The Taliban, claiming responsibility of the attack, said it was in response to Obama's visit to sign a security pact and strategic partnership deal with Afghan President Hamid Karzai, which would pave way for a longer-term US role in Afghan soil even after the US troops leave by the end of 2014, a Reuters report said.

Addressing the Americans from a US base north of Kabul, Obama said it was time to end the war in Afghanistan.

As we emerge from a decade of conflict abroad and economic crisis at home, it's time to renew America, Obama said. This time of war began in Afghanistan, and this is where it will end.

The Taliban have demanded the US troops pull out of Afghanistan, and leave the responsibility to rebuild the country to the locals.

This attack was to make clear our reaction to Obama's trip to Afghanistan, Taliban spokesman Zabihullah Mujahid told Reuters over telephone from an undisclosed location. The message was that instead of signing of a strategic partnership deal with Afghanistan, he should think about taking his troops out from Afghanistan and leave it to Afghans to rebuild their country.

Wednesday's attack was the latest in a series of Taliban-led violence referred to as the spring offensive.