KANDAHAR, Afghanistan — The soldier accused of killing 16 Afghan civilians, most of them children, and burning their bodies was trained as a sniper and recently suffered a head injury in Iraq, U.S. officials said Monday.

The name of the suspect, a married, 38-year-old father of two, has not been released. Defense Secretary Leon Panetta said he may face capital charges, and that the United States must resist pressure from Washington and Kabul to change course in Afghanistan because of anti-American outrage over the shooting.

“We seem to get tested almost every other day with challenges that test our leadership and our commitment to the mission that we’re involved in,” Panetta told reporters traveling with him to Krygzystan. “War is hell.”

A U.S. official speaking on condition of anonymity said that during a recent tour of duty in Iraq, the suspect was involved in a vehicle accident and suffered a head injury.

The vehicle accident was not a combat-related event, the official said. There was no available indication about the extent of the injury, or whether his injury could be linked to any abnormal behavior afterward.

Two U.S. officials speaking on condition of anonymity said the suspect had been trained as a sniper.

Sunday’s attack in southern Kandahar province unfolded in two villages near a U.S. base. Villager Mohammad Zahir recounted how an American soldier burst into his home in the middle of the night, searched the rooms, then dropped to a knee and shot his father in the thigh as he emerged from a bedroom.

“He was not holding anything — not even a cup of tea,” Zahir said.

The soldier, a staff sergeant who has been in the military for 11 years and served three tours in Iraq, was being held in pretrial confinement in Kandahar by the U.S. military while Army officials review his complete deployment and medical history, Pentagon officials said.

The soldier’s name was not released because it would be “inappropriate” to do so before charges are filed, said Pentagon spokesman George Little.

But Panetta, in his first public remarks on the incident, said Monday evening the death penalty is a consideration as the military moves to investigate and possibly put the suspect on trial.

The soldier was deployed to Afghanistan on Dec. 3. He was attached Feb. 1 to the village stability program in Belambai, a half-mile from one of the villages where the attack took place, the source said.

Zahir told how he watched the soldier enter his house and move through it methodically, checking each room.

“I heard a gunshot. When I came out of my room, somebody entered our house. He was in a NATO forces uniform. I didn’t see his face because it was dark,” he said.

Zahir, 26, said he quickly went to a part of the house where animals are penned.

“After that, I saw him moving to different areas of the house — like he was searching,” he said.

His father, unarmed, then took a few steps out of his bedroom, Zahir recalled. Then the soldier fired.

“I love my father, but I was sure that if I came out he would shoot me too. So I waited,” Zahir said. His mother started pulling his father into the room, and he helped cover his father’s bullet wound with a cloth. Zahir’s father survived.

After the gunman left, Zahir said he heard more gunshots near the house, and he stayed in hiding for a few minutes to make sure the soldier was gone.