IOWA CITY, Iowa — Retired farmer Allan Phillips had been out of legal trouble for 40 years when he asked Iowa’s governor to restore the gun rights he lost in 1978.

Phillips, 76, wrote in his 2017 application for clemency that it was time for him to get past the consequence of his misdemeanor conviction for having a loaded hunting gun in his vehicle. But his request would ultimately land him in legal jeopardy.

As his application slowly moved forward, Phillips received a surprise visit earlier this year from state investigators conducting a background check. They found that he had access to firearms at his home in West Branch in violation of the gun ban that his 41-year-old conviction had triggered. They soon charged him with being a felon in possession of a firearm, which can carry up to five years in prison.

The prosecution of Phillips, who is awaiting trial, has reignited debate about whether the lifetime loss of gun rights is too harsh for some defendants and shows how hard it is to get them restored once lost. The county sheriff, who wrote a letter describing Phillips as a law-abiding citizen as part of the application process, said Phillips likely could have kept his guns off the radar had he not applied for legal recognition to own them.

“He probably would have been better off staying quiet,” Sheriff Warren Wethington said.

Phillips’ wife, Linda, called the case unfair but said “I don’t think there’s anything we can do about it.” She said her husband didn’t wish to comment.

Phillips is not a felon despite the charge he faces. He was convicted of a misdemeanor for carrying a prohibited weapon in 1978. He was caught with a loaded trap gun, typically used for shooting at clay targets, in his car in Johnson County, records show. He was sentenced to one year probation. But the conviction triggered the lifetime loss of his firearm rights under Iowa law because it was an aggravated misdemeanor involving a firearm.

Phillips did not get in any more legal trouble — except for a 2013 traffic ticket — and continued farming on 160 acres in Cedar County, according to his application.

“Really at my age of 75, I would like to clear my name of this charge and have my rights restored,” he wrote in the application, obtained through the open records law.

Like its lifetime ban on voting rights for convicted felons, Iowa is among the nation’s harshest states when it comes to stripping gun rights from criminal offenders. People who are convicted of felonies and some misdemeanors lose their right to purchase, use and own firearms in Iowa for life, unless restored by the governor. Many other states only limit the loss of gun rights to violent offenders, allow those rights to be restored after a specific time period, or outlaw the possession only of handguns.

Gun safety advocates say the bans promote public safety by keeping weapons out of the hands of potentially dangerous people. Critics say the punishment can be draconian, particularly for those who are convicted of misdemeanors and who grew up hunting and shooting.

Five years after completing their sentences, Iowa offenders can apply to the governor to have their gun rights restored. Relatively few apply and less than 10% of them are successful, according to state officials.

Applicants must complete a detailed form that asks for information about the crime and copies of their criminal histories and credit reports. Letters of recommendation from the prosecuting attorney, the sentencing judge, the county sheriff and employers are also requested.

The Iowa Board of Parole then considers whether to support the application, based on factors including whether the person has demonstrated “exemplary character,” shown remorse and given back to society. If the board gives a positive recommendation, the governor then decides whether to grant it. The process can take two years.

Republican Gov. Kim Reynolds, who supported a 2017 law that expanded gun rights and was endorsed last year by the National Rifle Association, did not restore firearm rights to any ex-offenders during her first 19 months in office, according to an annual report her office sent lawmakers in January. Gov. Terry Branstad restored gun rights for 26 ex-offenders during the previous 6 1/2 years, about four per year.

Phillips’ application was proceeding when Division of Criminal Investigation agents made an unannounced visit to his home Feb. 27. There, they found that he had access to three shotguns and a long gun as well as boxes of ammunition for those weapons, according to a criminal complaint. They arrested him on the felony charge two weeks later, and he was released from custody after a court appearance.

Phillips has pleaded not guilty and is due in court July 12 for a pretrial conference.