JOINT BASE LEWIS-MCCHORD, WASH. — The American soldier accused of killing 16 Afghan civilians, many of them women and children who were asleep in their villages, pleaded guilty to murder Wednesday and acknowledged to a judge that there was “not a good reason in this world” for his actions.

Staff Sgt. Robert Bales’ plea ensures that he will avoid the death penalty for the middle-of-the night slayings that so inflamed tensions with the Afghan population that the American military suspended combat operations.

Prosecutors said Bales, 39, slipped away before dawn on March 11, 2012, from his base in Kandahar province. Armed with a 9 mm pistol and an M-4 rifle equipped with a grenade launcher, he attacked a village of mud-walled compounds called Alkozai, then returned and woke up a fellow soldier to tell him about it.

The soldier didn’t believe Bales and went back to sleep. Bales then left to attack a second village known as Najiban.

Relatives of the victims were outraged at the idea that Bales could escape execution when they spoke in April in Kandahar.

“A prison sentence doesn’t mean anything,” said Said Jan, whose wife and three other relatives were slain. “I know we have no power now. But I will become stronger, and if he does not hang, I will have my revenge.”

A jury will decide in August whether the soldier is sentenced to life with or without the possibility of parole.

For each charge, the judge asked Bales a series of questions to assess the validity of his plea. Did he believe he had legal justification to kill the victims? Was he acting in self-defense? Did anyone force or coerce him to commit the murders?

For each, Bales answered, “No sir.”

In a clear, steady voice, Bales also read from a statement.

“This act was without legal justification, sir,” the infantryman said while seated at a defense table, his hands folded in front of him.

At one point the judge asked Bales why he killed the villagers.

Bales responded, “Sir, as far as why — I’ve asked that question a million times since then. There’s not a good reason in this world for why I did the horrible things I did.”