BALANDI, Afghanistan – Moving from house to house, a U.S. Army sergeant opened fire Sunday on Afghan villagers as they slept, killing 16 people — mostly women and children — in an attack that reignited fury at the U.S. presence after a wave of deadly protests over Americans burning Qurans.

The attack threatened the deepest breach yet in U.S.-Afghan relations, raising questions both in Washington and Kabul about why American troops are still fighting in Afghanistan after 10 years of conflict and the killing of Osama bin Laden.

The slayings, one of the worst atrocities committed by U.S. forces during the Afghan war, came amid deepening public outrage spurred by last month’s Quran burnings and an earlier video purportedly showing U.S. Marines urinating on dead Taliban militants.

The Quran burnings sparked weeks of violent protests and attacks that left some 30 Afghans dead, despite an apology from President Obama. Six U.S. service members were also killed by Afghan soldiers, although the tensions had just started to calm down.

According to U.S. and Afghan officials, Sunday’s attack began around 3 a.m. in two villages in Panjwai district, a rural region outside Kandahar that is the cradle of the Taliban and where coalition forces have fought for control for years. The villages are about 500 yards from a U.S. base in a region that was the focus of Obama’s military surge strategy in the south starting in 2009.

Villagers described cowering in fear as gunshots rang out and a soldier roamed from house to house firing on those inside. They said he entered three homes in all and set fire to some of the bodies. Eleven of the dead were from a single family, and nine of the victims were children.

U.S. officials said the gunman, identified as an Army staff sergeant, acted alone, leaving his base in southern Afghanistan and opening fire on sleeping families in two villages. Initial reports indicated he returned to the base after the shooting and turned himself in. He was in custody at a NATO base in Afghanistan.

The suspect, from Joint Base Lewis-McChord, Wash., was assigned to support a special operations unit of either Green Berets or Navy SEALs engaged in a village stability operation, a U.S. official said.

Such operations are among NATO’s best hopes for transitioning out of Afghanistan, pairing special operations troops with villagers chosen by village elders to become essentially a sanctioned, armed neighborhood watch.

Some residents said they believed there were multiple attackers, given the carnage.

“One man can’t kill so many people. There must have been many people involved,” Bacha Agha of Balandi village said. “If the government says this is just one person’s act we will not accept it. … After killing those people they also burned the bodies.”

In a statement, Afghan President Hamid Karzai left open the possibility of more than one gunman. He initially spoke of a single U.S. gunman, then referred to “American forces.”

The statement quoted a 15-year-old survivor named Rafiullah, who was shot in the leg, as telling Karzai in a phone call that “soldiers” broke into his house, woke up his family and began shooting them.

“This is an assassination, an intentional killing of innocent civilians and cannot be forgiven,” Karzai said.

Obama phoned the Afghan leader to express his shock and sadness, and offered condolences to the grieving families and to the people of Afghanistan.

In a statement released by the White House, Obama called the attack “tragic and shocking” and not representative of “the exceptional character of our military and the respect that the United States has for the people of Afghanistan.”

The violence over the Quran burnings had already spurred calls in the United States for a faster exit strategy from the 10-year-old Afghan war. Obama even said recently that “now is the time for us to transition.” But he also said he had no plan to change the current timetable that has Afghans taking control of security by the end of 2014.

In the wake of the Quran burnings, the top U.S. commander in Afghanistan, Gen. John Allen, visited troops at a base that was attacked last month and urged them not to give in to the impulse for revenge.