GREAT FALLS, Mont. (AP) — Two Montana men who were sentenced to prison for violating the terms of the probation in separate crimes won’t be eligible for parole until they complete a writing assignment given because they falsely claimed to have served in the military to have their cases moved to a Veterans Court.

Cascade County District Judge Greg Pinski sentenced Ryan Patrick Morris, 28, and Troy Allan Nelson, 33, on Friday. 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. Pinski suspended three years of each defendant’s sentence.

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

Veterans Court programs create and supervise treatment plans to address crimes that may be due to service-related post-traumatic stress disorder, traumatic brain injury, anger issues or substance abuse.

“I want to make sure that my message is received loud and clear by these two defendants,” Pinski said Friday.

Morris claimed in 2016 he did seven combat tours in Iraq and Afghanistan, had PTSD and had his hip replaced after being injured by an improvised explosive device. He was sentenced to perform 441 hours of community service with a veteran’s organization — one for each Montanan killed in combat since the Korean War. Court records said he only completed 10 hours.

Nelson managed to get himself enrolled in the Veterans Treatment Court before it was determined he hadn’t served in the military, the Great Falls Tribune reported .

Once released from prison, they must perform 441 hours of community service.