A Marine private who pleaded guilty to reduced charges in the killing of an innocent Iraqi civilian was sentenced Wednesday to 18 months in custody by a military judge who wanted to mete out a five-year punishment but had to stick with terms of a plea deal.

"You have a very fortuitous pretrial agreement," the judge, Lt. Col. David Jones, told Pfc. John J. Jodka III.

The judge ruled after reviewing evidence including a video, made by the squad two days after the killing, in which the 20-year-old private participated in profane jokes about killing more people and car bombers.

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

The judge said that if Jodka cooperates against all his co-defendants who stand trial he can receive a general discharge. The judge said he would have given Jodka a dishonorable discharge.

The time in custody appeared to include the 189 days Jodka has already served in the brig.

Jodka earlier apologized to the family of victim Hashim Ibrahim Awad, 52, to his own family and to "my Marine Corps whose highest ideals I have failed to uphold."

In final arguments for the prosecution, Lt. Col. John Baker recommended 11 years in prison.

"They killed a 52-year-old crippled man in cold blood," Baker said.

Of Jodka, he added, "He failed to stop the madness and not pull the trigger."

Defense attorney Joseph Casas asked for a sentence of time already served and painted a picture of a war-stressed, young Marine trained to follow orders. He said Jodka's actions were due to the poor command of squad leader Sgt. Lawrence Hutchins III, who is awaiting court-martial.

Casas also criticized the nature of the war.

"As we sit here today the politicians in D.C. can't figure this war out," he said. "How can we expect a young man like Pfc. Jodka to understand everything there?"

Jodka was in a squad of seven Marines and a Navy corpsman charged with kidnapping and murdering Awad in the village of Hamdania. Prosecutors say the troops grabbed Awad when they couldn't find a known insurgent, took him to a roadside hole, shot him and tried to cover it up.

As part of a plea deal, Jodka pleaded guilty Oct. 27 to charges of assault and conspiracy to obstruct justice, and prosecutors dropped other charges including murder and kidnapping. The deal required Jodka to testify.

After initially deciding not to show the tape in court, the judge returned from a conference with lawyers and said, "There is a great need to know that we are a public forum. I've made my preference known that we play all evidence in open court."

The prosecution then played brief segments in which Jodka was present. The video was shot by a Marine and showed Jodka and others atop a personnel carrier, possibly at dawn. It is not clear who is speaking at specific times.

A voice that appears to be the camera operator's says, "J.J., say what you know," and then, "You gonna kill some more (expletive) today?"

"Yeah," is the answer, apparently by Jodka.

Later, a voice asks, "Who's been responsible for the most bombings?"

"Arab men," another voice responds, and several voices shout, "Middle-aged."

One voice says, "(Expletive) ... Kill 'em. God will sort it out."

Then there is talk of identifying car bombs. The camera pans to a white truck in the distance and the Marines shout, "White truck, white truck!" One voice says, "I betcha he's gonna plant some bombs later today, get that (expletive)."

In earlier testimony, Jodka referred to the videotape and said, "I was blowing off steam, just making a comment (for the video) ... trying to start the day off with a little levity."

Jodka, who never fully explained to the court how the squad came to kill Awad, told the judge he felt Wednesday's testimony showed "the fear and frustration we felt in Iraq."

"I'm really not a bad person," he said. "I'm not a bad Marine."

He also acknowledged that the order to shoot Awad was not legal.

The closest Jodka came to an explanation for the killing was to say, "I wasn't able to tell who the man was because it was very dark. There was no moon and I was far away at a distance."

Asked by his civilian lawyer, Jane Siegel, whether he would have fired if he knew that the target was not Saleh Gawad, a known insurgent, Jodka replied firmly, "Absolutely not."

Jodka, of Encinitas, Calif., said he agonized for many months before he decided to plead guilty.

"I decided to plead guilty because in the end it was the right thing to do," Jodka said. "I had to weigh in myself the need for truth as opposed to the loyalty to the squad I had bonded with in Iraq."

Jodka spoke in an unsworn statement which meant prosecutors could not cross-examine him.

Among defense witnesses were two sergeants who spoke of the importance of loyalty among members of a squad in the field and of the frustrations which have faced Marines trying to apprehend insurgents who plant explosive devices. One said Gawad was cocky because he had been taken in several times but was released for lack of evidence.

But neither sergeant knew Jodka well and they did not give specific testimony about him.

The most emotional witness for the Marine was his mother, Carolyn Jodka, who spoke of her love for her son, of the anguish in seeing him brought to her in the brig in shackles and "to see this conflict between loyalty to his squad and to the core values of the Marines."

She implored the judge to consider Jodka's youth.

"He's a young man," she said. "He understands his role and he understands what he did was wrong. What I hope is you will enter a just decision and a wise decision so he can go on and have a life beyond this."

She added, "I know this will shape his life. I hope it doesn't define his life."

Jodka was the first Marine in the case to get a plea deal. The Navy corpsman and two other Marines also have made plea agreements. The corpsman, Petty Officer 3rd Class Melson J. Bacos, was sentenced to 10 years in prison but will only serve one because of his plea agreement.

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