One of four U.S. soldiers accused of raping a 14-year-old Iraqi girl last spring and killing her and her family pleaded guilty Wednesday and agreed to testify against the others.

Spc.James P. Barker agreed to the plea deal to avoid the death penalty, said his civilian attorney, David Sheldon.

The U.S. military judge presiding over the case, Lt. Col. Richard Anderson, asked Barker why he participated in the attack in Mahmoudiya, a village about 20 miles south of Baghdad. It was among the worst in a series of alleged attacks on civilians and other abuses by military personnel in Iraq.

Visit FOXNews.com's Iraq Center for more in-depth coverage.

"I hated Iraqis, your honor," Barker answered. "They can smile at you, then shoot you in your face without even thinking about it."

Sgt. Paul E. Cortez and Pfc. Jesse V. Spielman, members of the 101st Airborne Division with Barker, also are charged in the case. Cortez deferred entering a plea during his arraignment Wednesday morning. Spielman will be arraigned in December. The fourth soldier, Pfc. Bryan L. Howard, also deferred entering a plea at his arraignment in October.

A fifth person, former Army private Steve Green, 21, pleaded not guilty last week to civilian charges including murder and sexual assault.

Green was discharged from the Army for a "personality disorder" before the allegations became known, and prosecutors have yet to say if they will pursue the death penalty against him.

The defendants are accused of raping the girl and burning her body to conceal their crimes, then killing the girl's father, mother and 6-year-old sister.

After entering his plea Wednesday, Barker gave the court a vivid account of the events.

Barker said he and the others were drinking and playing cards while they manned a traffic checkpoint. Green brought up the idea of raping the girl and killing her family, he said.

"He brought it up to me and asked me what I thought about it. At a couple of points, I told him he was crazy," Barker said.

Barker said he and Green then approached the others with the idea, but there never was a verbal agreement to do it.

"Things just got set in motion, we just started changing (clothes), myself, Cortez and Green," Barker said. "By the time we started changing clothes, it was more or less a nonverbal agreement that we were going to go along with what we were discussing."

Barker said he, Green and Cortez raped the girl, and Green killed the girl, her parents and her sister.

Complete coverage is available in FOXNews.com's Iraq Center.