A military court has sentenced a U.S. soldier to 18 years in prison after he pleaded guilty to a role in the killing of three Iraqi detainees during a raid north of Baghdad.

Military officials at Fort Campbell, Kentucky say Private First Class Corey Clagett fatally shot one detainee during the May 9 raid on a suspected insurgent camp. They say he and three other soldiers, from the 3rd Combat Brigade of the 101st Airborne Division made it look as though the detainees were shot while trying to escape.

In an agreement with prosecutors, Clagett, 22, pleaded guilty to several charges including murder and conspiracy to obstruct justice.

The soldiers say they were following orders from their commanders to kill all military-aged males during the assault.

Earlier this month, Specialist Juston Graber pleaded guilty to one charge of aggravated assault with a deadly weapon for his role in the same case. A military court sentenced him to nine months in prison.

A military court also sentenced Specialist William Hunsaker to 18 years in prison after he pleaded guilty to murder for his role in the killings.

The squad leader, Staff Sergeant Raymond Girouard, is awaiting his court martial scheduled for March.

Some information for this report was provided by AFP, AP and Reuters.