Military investigators were combing through a U.S. Army sergeant’s personnel and medical records Monday to determine what might have caused him to slip away from his base in southern Afghanistan and allegedly massacre 16 sleeping villagers, most of them women and children, in the black of night.

U.S. commanders said they think the shooter acted alone in Sunday’s rampage in the rural Panjwai district of Kandahar province. But they were struggling to deduce a motive for the attack, which has prompted outrage among Afghan officials and inflamed an already strained relationship between Washington and Kabul.

The suspect, a trained sniper, received a diagnosis of traumatic brain injury after sustaining a head injury in Iraq during a vehicle rollover in 2010, two U.S. military officials said, speaking on the condition of anonymity to discuss sensitive details of the case. The soldier was subsequently declared fit for duty, the officials said.

Other U.S. military officials said they were working quickly to build a case against the suspect but declined to identify him until charges could be filed. They described him as a married, 38-year-old staff sergeant with two children who joined the Army 11 years ago. They said he had served three tours of duty in Iraq and deployed to Afghanistan for the first time in December.

“The evidence at this point, both in terms of observations and reports and interviews, leads us to believe that he acted as an individual,” Marine Gen. John R. Allen, the commander of U.S. and NATO forces in Afghanistan, told CNN. “We’re going to do a thorough investigation. We’re going to hold this individual accountable.”

Under military law, the shooter, if convicted, could face the death penalty.

U.S. officials said the soldier abruptly walked off a combat outpost about 3 a.m. Sunday local time. Allen said that an Afghan soldier standing watch reported the unauthorized departure but that others on the base could not mobilize quickly enough to track down the missing American before the attack, the deadliest on civilians by a U.S. service member during the decade-long Afghanistan war.

“There was a head count done amongst the American soldiers; [they] recognized that he was missing, unaccounted for,” Allen said. “We put together a search party right away, and it was as that search party was forming that we began to have indications of the outcome of his departure.”

Defense Secretary Leon E. Panetta said the soldier returned to the base on his own, admitted what he had done and surrendered.

“He went out in the early morning and went to these homes and fired on these families,” Panetta told reporters. “And at some point after that came back to the [forward operating base] and basically turned himself in and told individuals what had happened.”

Asked whether the soldier had confessed to the killings, Panetta said he suspected “that was the case.”

U.S. military officials said the soldier was part of an Afghan police training program in villages in Kandahar province and had been assigned to support U.S. Special Operations forces in the area.

The officials said that it was highly likely that the suspect would be brought back to the United States to face charges and a possible court-martial, but that a final decision was pending. The probe is being led by the Army’s Criminal Investigation Command.

PTSD controversy

The soldier’s unit, the 3rd Stryker Combat Brigade, 2nd Infantry Division, deployed to southern Afghanistan in December from Joint Base Lewis-McChord, an Army and Air Force installation near Tacoma, Wash.

The cornerstone base of the Pacific Northwest recently became a focus of public scrutiny after allegations that its military doctors had altered diagnoses of post-traumatic stress disorder for hundreds of soldiers.

A military probe of the base’s medical center is scrutinizing assertions by staff members and soldiers that, starting in 2007, diagnoses for at least 300 service members were downgraded to lesser conditions. Some patients have alleged that the diagnoses were changed so that the military would not be responsible for their treatment and long-term care.

The commander of Lewis-McChord’s Madigan Army Medical Center has been placed on leave during the investigation, and a leading forensic psychiatrist has resigned.

Some military support groups near Lewis-McChord have accused base officials of not allowing troops sufficient time to heal between deployments from a variety of injuries.

Jorge Gonzales, an antiwar activist and the director of a program that advocates for better treatment for traumatized military personnel, said the base’s medical center is understaffed and overwhelmed by troops suffering from traumatic and stress disorders.

“They’re just not ready for all these soldiers coming back with problems,” said Gonzales, a former soldier once posted at Lewis-McChord. “They want to get soldiers shipped out as fast as they can. . . . They have a quick-fix program — just get you medicated and send you back out.”

Last year, the base had a major spike in soldier suicides, with 12 confirmed cases.

Sheri Van Veldhouse, a military spouse who organizes a traumatic-brain-injury support group near the base, said redeploying a soldier with such a condition is especially risky. She helped launch the support group after her husband, a retired soldier, suffered a head injury when he was hit by a car.

“There’s no way in the world I’d want him out on a battlefield after a brain injury,” she said. “You’re handing them a gun. . . . The anger issues are there. They have flash responses to that anger. It’s not a good combination.”

The ‘most troubled’ base

Lewis-McChord has also attracted notoriety in the past for battlefield crimes committed by its soldiers.

Four members of a platoon from the 5th Stryker Brigade, 2nd Infantry Division were convicted for their roles in the murders of three unarmed Afghan civilians in 2010. Military prosecutors said that members of the platoon formed a “kill team” to hunt down random Afghans for sport and that the ringleader hoarded their victims’ body parts as war trophies.

In January, a 24-year-old veteran of the Iraq war who had served at Lewis-McChord shot and killed a ranger at Mount Rainier National Park. The former soldier, whose body was later found in the wilderness, died of exposure.

Stars and Stripes, a taxpayer-funded publication that covers the armed services, recently labeled Lewis-McChord the most troubled military base in the country.

Maj. Chris Ophardt, an Army spokesman at the base, said the incidents occurred over several years and attracted outsize attention because of the large antiwar movement in the area and robust media coverage.

“We have more critics here, and that’s both a good thing and a bad thing,” Ophardt said. “There’ve been some high-profile incidents. We take them seriously, and we’re looking into them to see if there are any underlying problems we need to address.”

Staff writers Rajiv Chandrasekaran, Karen DeYoung and Greg Jaffe and staff researcher Julie Tate contributed to this report.