A former South Carolina sheriff’s deputy has been sentenced to a year in federal prison and $100 fine for selling guns to a prohibited person, the Justice Department announced this week.

Tony Allen Riley, 62, pleaded guilty to two counts of federal gun violations in March in a Charleston federal court, according to the case docket.

According to court documents, Riley sold firearms to a man who had been indicted on drug crimes in December 2013. Also, at the time, Riley was a deputy with the Berkeley County Sheriff’s Office.

As to why Riley, an 18-year veteran law enforcement officer and 20 years with the Navy, would commit such a crime, his attorneys characterized a lonely man desperately chasing romance after losing his wife to cancer.

“When good, decent people do stupid, bad things, there can be a temptation to make excuses. To justify. To defend. Tony Riley did a bad, stupid thing. And nothing can excuse or justify the bad, stupid thing he did,” his attorneys said in a letter to the court.

After Riley’s wife died in 2012 following a 10-year battle with cancer, he befriended local bikers, including Fred Condrey, as they bonded over beer and motorcycles, his attorneys said.

Riley also became friends with Condrey’s girlfriend, Kim Eller. Riley’s feelings for Eller grew into a crush and he eventually agreed to transfer to her three firearms, which he knew would be given to Condrey, who was not legally permitted to buy a gun.

“Unbeknownst to Riley, Kim had approached the FBI with the goal of helping her boyfriend. When she asked Tony to buy her a gun that she could give to Condrey, Tony knew it was wrong,” Riley’s attorneys said, adding Riley was arrested four months later.

The maximum penalty for Riley’s crimes is a $250,000 fine and/or 10 years in prison. At Riley’s sentencing, U.S. District Judge Margaret Seymour read letters from Riley’s previous co-workers and members of the community who pleaded with the judge to go easy on the former officer.

“I do not believe, based on my dealings with Tony, that he represents any threat to the community. I believe that if the court exercises leniency in sentencing him, he will prove to be an asset to the community and a good citizen,” attorney and retired Navy Capt. Michael Brown wrote.

Carolyn Ware, of Moncks Corner, said: “We have all made mistakes. Tony made a mistake that has forever changed his life. While I believe all crime deserves punishment, I also believe the two years that this case has been open has been part of his punishment. It has affected his family relations, friendships and freedom. Tony Riley is a good person that has learned a valuable lesson.”

Yet, U.S. Attorney Beth Drake is singing a different tune, saying it’s the Justice Department’s top priority to prosecute officers found “dishonoring their badge and the bravery and integrity of their fellow officers.”

“Effective community policing is founded on both the desire of officers to protect and serve and the trust of the people the officers serve. That trust is critical to both the safety of our officers and our communities,” Drake said in a statement.

Daniel Terrill contributed to the reporting of this article