Jeremy Morlock, a U.S. soldier who admitted to the murders of three Afghan civilians in 2009 and 2010 and struck a plea deal to testify against other soldiers in his unit also accused of crimes, was sentenced on Wednesday by a military judge to 24 years in prison, with the opportunity for parole within 7 years.

Judge Lt. Col. Kwasi Hawks, at Joint Base Lewis-McChord in Washington, said Wednesday he had initially intended to sentence Morlock to life in prison but had to abide by the plea deal.

Morlock, of the Army's 5th Stryker Brigade based in Washington State, will also receive credit for time served of nearly a year, his lead attorney Frank Spinner said, according to NPR. Morlock will be released from military service with a dishonorable discharge.

Morlock lured villagers away from others and killed them, planting weapons near the victims and calling for help, according to court testimony.

In total, 12 U.S. soldiers were allegedly part of what has been described as a ill team in Afghanistan. On Monday, German website Der Spiegel published photos of members of the unit posing with the bodies of Afghani's killed. The U.S. Army apologized for the distress these photos and condemned the actions depicted in the photos as repugnant. In a pair of the photos two soldiers are shown lifting the head of a villager by the hair.

The incidents took place in villages in the southern province of Kandahar, near Forward Operating Base Ramrod. Three other soldiers have also been charged with murder.

You'd select a target, you'd kill them, and then you'd use a 'drop' weapon to establish later that, 'They had a weapon, and that's why I killed them,' Hawks said, according to the LA Times.

Yes, sir, Morlock said.

Were you going to shoot at people to scare them, and it got out of hand, or was the plan to kill people? Hawks said.

The plan was to kill people, Morlock said.

The unit leader, Staff Sgt. Calvin Gibbs, is said to have been the person leading the push. Morlock's plea documents say the killing scenarios were Gibbs' idea.