KABUL, Afghanistan — Insurgents beheaded 17 people at a party in a Taliban-controlled area, and an Afghan soldier killed two U.S. troops, bringing the two-day death toll Monday to about 30.

Near-daily attacks by militants and increasingly frequent deadly violence against NATO troops by their Afghan allies highlight an embarrassing failure of Western policy: After nearly 12 years of military intervention, the country is not pacified. Once the United States and other countries pull out their troops, chaos seems almost certain to return and Taliban domination in large parts of the country is hardly implausible.

The beheadings occurred in southern Helmand, the same province where more than 100 insurgents attacked an Afghan army checkpoint and killed 10 soldiers.

Helmand was the centerpiece of President Obama’s surge, when he ordered 33,000 additional U.S. troops to Afghanistan to help the military with a counterinsurgency plan. That plan hoped to turn the tide in Helmand and neighboring Kandahar and establish the governmental institutions that would allow the Afghan government to take control of the Taliban heartland.

Two years later, however, Helmand is still so lawless that Afghan government officials couldn’t even go to the Taliban-controlled town where the beheadings were reported.

In the beheadings, a local government official initially said the victims were civilians at a celebration late Sunday involving music and dancing in Helmand’s Musa Qala district. The official, Neyamatullah Khan, said the Taliban killed the partygoers for flouting the extreme brand of Islam embraced by the militants.

But a provincial government official said later that those killed were caught up in a fight between two Taliban commanders over two women, who were among the dead. Daoud Ahmadi, a spokesman for the provincial government, said shooting broke out during the fight. He said it was unclear whether the music and dancing triggered the violence and whether the dead were all civilians or possibly included some fighters.

Ahmadi said all of the bodies were decapitated, but it was not clear if they had been shot first.

In the latest insider attack, two American soldiers were killed in eastern Laghman province.

There were conflicting reports about whether the attack was intentional or accidental.

In Washington, a U.S. Defense Department official said the Afghan soldier fired a rocket-propelled grenade at the Americans, and that this seemed to indicate that it was an intentional act. The official spoke on condition of anonymity because an investigation is under way, said he was unaware of any indications the shooting was accidental.

Noman Hatefi, a spokesman for the Afghan army corps in eastern Afghanistan, said a group of U.S. and Afghan soldiers came under an insurgent attack in Laghman province. He said the two Americans were killed when an Afghan soldier fell and accidentally discharged his weapon.