An American soldier walked off his base in a remote southern Afghan village shortly before dawn Sunday and opened fire on civilians inside their homes, killing at least 16, including nine children, Afghan officials said.

The shootings in the Panjwai district of Kandahar province appeared to mark the deadliest intentional attack on civilians by a U.S. soldier in the decade-long Afghanistan war. Although U.S. officials promptly detained the suspect, a staff sergeant, the incident seemed certain to stoke anti-American sentiment at a time of growing unease about the presence of foreign troops in Afghanistan and increasing pessimism among Americans about the U.S. mission here.

Coming as Afghan rage over the burning of Korans by U.S. soldiers last month was beginning to taper off, the killings Sunday threatened to spark a new crisis in the strained relationship between the United States and Afghanistan. The two nations are in the midst of contentious negotiations over an agreement that could extend the presence of U.S. troops in the country beyond 2014.

The incident also provided fresh fodder to critics of the Obama administration’s Afghanistan strategy who are trying to portray the 2009 troop surge as a failed attempt to secure a dignified exit.

Afghan President Hamid Karzai called the shootings an “assassination” and demanded an explanation from U.S. officials.

President Obama and Defense Secretary Leon E. Panetta called Karzai on Sunday to discuss the incident. Obama expressed “shock and sadness” and vowed to “hold fully accountable anyone responsible” for the killings, the White House said in a statement.

“This incident is tragic and shocking and does not represent the exceptional character of our military and the respect that the United States has for the people of Afghanistan,” Obama said.

U.S. officials shed no light on the motive or state of mind of the alleged shooter. The Associated Press reported Sunday that the suspect was from Fort Lewis, in Washington state. He was taken into custody shortly after the shooting rampage.

“It appears he walked off post and later returned and turned himself in,” said Lt. Cmdr. James Williams, a military spokesman.

U.S. military officials stressed that the shooting was carried out by a lone, rogue soldier, differentiating it from past instances in which civilians were killed accidentally during military operations.

But the shooting left American soldiers on edge, bracing for retaliatory attacks.

“My fear is that those Afghans in the region that were indifferent to either side of this conflict will now, at least as a temporary emotional reaction, become active insurgents,” said a U.S. Army officer based in Kandahar, speaking on the condition of anonymity to express his fears candidly.

‘Callous acts’

A statement released by Karzai’s office recounted a conversation the Afghan president had with a relative of one of the victims. “You have asked the Americans again and again to avoid civilian casualties, but again the Americans are killing innocent people,” the statement quoted the relative as having said.

Fazal Mohammad Esaqzai, deputy chief of the Kandahar provincial council, said enraged villagers loaded the bodies into cars and drove to the entrance of the nearby U.S. base to demand answers.

“They were very angry,” said Esaqzai, who was part of an investigative delegation that visited the villages where the shootings occurred. “They wanted to do something to take revenge.”

Esaqzai, who said he saw 16 bodies, said villagers told him that around midnight, 11 people — three women, four children ranging in age from 6 to 9, and four men — were executed inside the home of a village elder.

“They entered the room where the women and children were sleeping, and they were all shot in the head,” Esaqzai said, adding that he was doubtful of the U.S. account suggesting that the killings were the work of a lone gunman. “They were all shot in the head.”

About an hour later, residents in a nearby village heard gunshots, and they later discovered the corpses of five men inside two houses located near each other, Esaqzai said.

Karzai’s statement said nine of the 16 victims were children. In addition, at least five people wounded in the incident were being treated at a U.S. military medical facility.

Afghan and American officials braced for a larger outcry later in the week.

“I cannot explain the motivation behind such callous acts,” Lt. Gen. Adrian J. Bradshaw, the deputy commander of the international coalition in Afghanistan, said in a statement. “They were in no way part of authorized military activity.”

Gen. John R. Allen, the top U.S. military commander in Afghanistan, pledged a thorough investigation and full cooperation with Afghan authorities.

The Taliban characterized the incident as a “massacre” committed during the course of a night raid by American and Afghan forces. “The so-called American peace keepers have once again quenched their thirst with the blood of innocent Afghan civilians,” the Taliban statement said.

Panjwai, southwest of Kandahar city, has been one of the most challenging battlegrounds for international forces. The area was the cradle of the Taliban movement in the early 1990s, and the militant group has fought hard to maintain sway over villages there.

Wresting Kandahar province from Taliban control was one of the chief objectives of Obama’s 2009 troop surge. U.S. military officials say they have been largely successful in restoring a semblance of Afghan government control in areas once commanded by the Taliban. But as the footprint of foreign troops starts to shrink in the south, many Afghans fear that the Taliban will regain lost ground.

Anger over the Koran burnings last month sparked nationwide riots and was cited as motivation for at least some of the fatal attacks on six U.S. military personnel. But reaction to the incineration of the holy books — which U.S. officials said was accidental — was relatively muted in the south.

Strains on partnership

The death toll Sunday was far higher than in the notorious string of killings carried out in 2010 by a rogue U.S. Army platoon that became known as the “kill team.” The slaying of at least three men in Kandahar’s Maywand district became one of the biggest scandals of the war, after investigators found that soldiers had kept body parts as trophies and passed off unarmed victims as insurgents.

Afghans were also angered this year when a video showing Marines urinating on the bodies of suspected insurgents was posted online.

The partnership between Karzai’s government and the Obama administration has been sorely tested in recent weeks by the Koran burnings, the killings of U.S. troops by their Afghan partners and other issues. Although the problems have led to increased calls by some American lawmakers for a speedier withdrawal, U.S. military officials said they were determined to absorb the political fallout and public anger that have been generated.

“We’re fully cognizant that even things that are unrelated can have an impact,” added a senior U.S. defense official in Washington, speaking on the condition of anonymity to discuss internal deliberations. “But we see no demonstrable effect on our operations or on our broader ability to work with our Afghan partners.”

Hamdard is a special correspondent. Staff writer Craig Whitlock in Washington contributed to this report.