Two Montana men who wrongly claimed to be military veterans while trying to get more favorable sentences were ordered to prison last week — and neither inmate will be eligible for parole until they complete an assignment that includes hand-writing the names of all Americans killed in the Iraq and Afghanistan wars.

Ryan Morris, 28, and Troy Nelson, 33, both claimed they were veterans as part of an effort to get their cases moved to a Veterans Court to receive lesser sentences.

2 GREEN BERETS KILLED IN COMBAT IN AFGHANISTAN IDENTIFIED

The two were sentenced Friday in Cascade County Court. Morris got 10 years in prison for violating the terms of his probation for felony burglary, while Nelson got five years on a drug possession conviction. Judge Greg Pinski suspended three years of each defendant’s sentence.

Troy Nelson, left, and Ryan Morris, right, were sentenced Friday for falsely claiming to be U.S. military veterans. (Cascade County Sheriff's Office)

Before either can be eligible for parole, however, Pinski ordered them both to handwrite the names of the 6,756 Americans killed in Iraq and Afghanistan; to write out the obituaries of the 40 Montanans killed in Iraq and Afghanistan; and send hand-written letters of apology to several veterans groups, making sure to identify themselves as having lied about military service to receive help and possibly a lesser sentence through a Veterans Court.

GREEN BERET ACCUSED OF KILLING SUSPECTED TALIBAN BOMB MAKER FACING 'AGONIZING' WAIT FOR TRIAL, WIFE SAYS

In 2016, Morris claimed he had PTSD and that he did seven combat tours in Iraq and Afghanistan. He also said he had his hip replaced after being injured by an improvised explosive device. Nelson reportedly got enrolled in Veterans Treatment Court before it was determined he didn't actually serve in the military.

Morris and Nelson were also each ordered to perform 441 hours of community service — one hour for each Montanan killed in combat since the Korean War — with a veteran's organization.

CLICK HERE TO GET THE FOX NEWS APP

The judge also ordered that, during the suspended portions of their sentences, Morris and Nelson must stand at the Montana Veterans Memorial in Great Falls for eight hours on each Memorial Day and Veterans Day wearing a placard that says: “I am a liar. I am not a veteran. I stole valor. I have dishonored all veterans.”

Additionally, Pinski made the men watch a video of a stolen valor suspect being confronted by a military member, according to KRTV. The judge said the sentences were punishment for lying to the court.

The Associated Press contributed to this report.