In this courtroom sketch, U.S. Army Staff Sgt. Robert Bales, right, stands in a military courtroom as Bales' wife Kari Bales looks on at left, Wednesday, June 5, 2013, during a plea hearing at Joint Base Lewis-McChord in Washington state. (Peter Millett/Associated Press)

In an unemotional, almost rote capitulation of one of the worst atrocities of the Afghanistan war, Staff Sgt. Robert Bales on Wednesday acknowledged rampaging through two villages, killing 16 Afghan civilians and burning many of their bodies.

He had little to offer as explanation for the killings.

When asked by a military judge why he had carried out the March 2012 rampage, the 39-year-old Bales was matter-of-fact in his response: “I’ve asked that question a million times, and there is not a good reason in the world for the horrible things I did.”

The exchange occurred shortly before the judge, Col. Jeffery Nance, accepted guilty pleas from Bales on charges of murder, attempted murder and aggravated assault as well as the unlawful use of steroids and alcohol at a U.S. military camp in Kandahar province. In exchange, he will avoid the death penalty when sentenced in August.

Bales, an Ohio native and father of two, had served four combat tours before the killings. His attorneys said their client, who had suffered a brain injury, was emblematic of the post-traumatic stresses associated with prolonged periods in combat zones. Bales enlisted in the military in November 2001, after the Sept. 11 attacks, and he reenlisted after six years.

The stocky and balding Bales, who wore his Army service uniform to the hearing, told the court Wednesday that before the killings he had been consuming the steroid Stanozolol for several months to get “fitter and leaner” and had a supply of four bottles, which allowed him to use the drug three times a week. He said he also consumed alcohol numerous times at the military camp with Special Forces operators.

Prosecutors noted that Bales said in a signed stipulation of facts that he took the drugs to “get huge and to get jacked.”

On March 11, 2012, Bales left Camp Belambay before dawn and walked to the nearby village of Alkozai. Once there, armed with a 9mm pistol and an M4 rifle, he briefly scuffled with an elderly woman before killing her, he said. Then he killed two men and another woman.

Bales then returned to Camp Belambay. In court, he didn’t describe what happened at the camp, but he is reported to have woken another soldier and told him what he did. The soldier didn’t believe him and went back to sleep.

Bales then went to a second village, Najiban. “I expected someone to be there,” he said when asked what he was looking for. “I intended to kill them.”

In Najiban, Bales fatally shot 12 more people, some of whom were asleep on blankets and carpets. He took a kerosene lamp he found and poured it over 10 of his victims. He told the court that he didn’t remember striking the match but realized from investigative reports that he must have done it. He said he remembered the fire.

Bales’s attorneys concluded after their client was examined by psychiatrists that he would not be able to mount an insanity defense, although they stressed that his state of mind was critical to what happened. Such factors will be considered at a sentencing hearing when a military panel, the equivalent of a jury, will determine whether the sentence will include the possibility of parole.

For the most part, Bales confined his answers to “yes, sir” and “no, sir.” He consulted with one of his civilian attorneys, Emma Scanlan, a number of times, and occasionally smiled as he chatted with her during breaks. A military lawyer and Scanlan’s co-counsel, John Henry Browne, also were at the defense table.

When asked to acknowledge his guilt in the premeditated murder of the 16 Afghans, Bales appeared to be following a script, inserting the sex and name of the victim where appropriate.

“I left the [camp] and I went to the nearby village,” he said when asked about one victim. “While inside a compound, I observed a male I now know to be Mohammad Dawud. I formed an intent to kill him and then did kill him by shooting him with a firearm. This act was without legal justification.”

The military released the names of the nine adult victims — the men, Dawud, Khudai Dad, Nazir Mohammad, Akhtar Mohammad and Haji Mohammad Naim; and the women, N’ikmarga, Shah Tarina, Zahrah and Naazyah. The names of the children were not released.

Bales also admitted to shooting and seriously wounding six Afghans, five of them children. “I did intend to kill them, but they survived,” he told the judge.

In Afghanistan, the killings sparked widespread protests and led to a temporary suspension of combat operations. The plea agreement was greeted with dismay by the families of the victims and some Afghan officials.

Human rights groups, while welcoming the prosecution of Bales, said the U.S. military needs to bring more cases to trial.

“When a person who has committed a heinous crime is held accountable, that is a positive step,” said John Sifton of Human Rights Watch. “Most Afghans know that a long list of other cases exists, over the last decade or more, involving alleged crimes and war crimes by U.S. personnel: homicides in detention, indiscriminate or excessive use of force, even torture. And they know that few of these cases have resulted in prosecutions, and of those that have gone to trial, even fewer have resulted in serious punishment.”

Some of Bales’s friends and family members, including his wife, Karilyn, sat in the front two rows of the public gallery behind him. When he entered the pastel-colored, low-ceilinged courtroom, Bales hugged a number of them. But for most of the proceeding, he maintained a composed, stoic demeanor as he admitted, without faltering, to the burning of civilians — including women and children.

Bales’s attorney said his client had wanted to admit his guilty publicly.

“Sergeant Bales has been waiting for the day that he can accept responsibility for what he’s done, the day that he can hopefully give some sense of peace to the people who are the victims of this tragedy, to his own family and to the soldiers who are still serving in Afghanistan,” Scanlan said after the hearing.