The boy, dressed in white and thought to be no older than 13, appeared amid the din of a wedding party in a small southern Afghan village and walked up to within 15 feet of a cluster of tables where everyone was eating. As he prepared to detonate his suicide bomb vest, the gathering flew into a panic.

“Everyone immediately tried to escape,” said Abdullah Jan, a guest at the wedding. But there was no time.

The boy’s suicide vest packed with explosives detonated, killing more than 40 people and wounding at least 80, said Zemarai Khan, a local police chief who was at the wedding and witnessed the attack.

Carried out late Wednesday in a small village in Kandahar province, the attack underscored the vulnerability of Afghan society even as President Hamid Karzai pursues negotiations with Taliban insurgents who have waged war with his government and Western forces for nearly nine years.

The Taliban has scoffed at Karzai’s peace offer and has carried out a wave of deadly attacks since the Afghan leader convened a national peace conference in Kabul, the capital, last week aimed at establishing a framework for talks with the insurgency.

The bombing of the wedding in the village of Nagahan in the Arghandab district was the deadliest of those attacks. The bomber, who witnesses said was 12 or 13, targeted a housing compound where men and young boys were celebrating the wedding, authorities said. Female guests were in a different area. The groom was injured but survived, Jan said. His brother was killed.

Though authorities have not determined why the wedding was targeted, witnesses said the groom and several members of his family were Afghan police officers. Also, residents of Nagahan have formed a tribal militia to help keep Taliban militants from infiltrating their area.

The Afghan Interior Ministry sent a team of investigators to Nagahan.

Zalmay Ayubi, a spokesman for Kandahar Gov. Tooryalai Wesa, said villagers were supportive of the Afghan government.

The blast drew condemnations from Western officials as well as Karzai, who called it an act by “merciless people, who target innocent people at social gatherings and simply want to kill as many as they can.”

Staffan de Mistura, the United Nations’ special representative for Afghanistan, called the attack an “outrageous act.”

“To specifically target people who were gathering at a moment of happiness to celebrate a wedding shows a total disregard for civilian life,” he said.

U.S. and North Atlantic Treaty Organization commanders hope to turn the tide against the insurgency by defeating it in Kandahar, the Taliban’s former headquarters and birthplace. With thousands of additional U.S. troops in southern Afghanistan or on their way, the United States and its Western allies will try to secure Kandahar while ramping up civilian projects in a bid to strengthen the Afghan government’s presence in the region and ultimately turn its residents against the rebels.

U.S. commanders have moved away from using the term “offensive” to describe their strategy in Kandahar, and are now trying to characterize their efforts in the crucial province as a gradual process that might take longer than initially expected.

Speaking Thursday in Brussels, the commander of U.S. and NATO forces in Afghanistan, U.S. Army Gen. Stanley A. McChrystal, said the campaign to secure Kandahar, originally expected to conclude by August, probably would stretch into the fall.

“I do think it will happen more slowly than we had originally anticipated,” McChrystal said. “It will take a number of months for this to play out, but I don’t think that’s necessarily a bad thing.... I think it’s more important that we get it right than we get it fast.”

The Taliban has been fighting back in the south with a wave of attacks that have included assassinations of Afghan officials and the shooting down of a NATO helicopter this week that killed four U.S. soldiers.

Daud Ahmadi, a spokesman for the Helmand province governor’s office, said that on Tuesday insurgents in the Sangin district hanged a 7-year-old boy they had accused of spying for U.S. forces. Ahmadi said insurgents kidnapped the boy from his home and hanged him from a tree in his village. Taliban leaders denied that they executed the boy.

The Taliban also denied any involvement in the attack on the wedding. However, Wesa, the Kandahar governor, said he was convinced that the Taliban was responsible.

“The Taliban are doing two things at once,” Wesa said. “On one side, they target people who are in favor of the government. Then, at the same time, they don’t want people to know their real face.”

alex.rodriguez@latimes.com