PORTLAND, Maine — A retired Maine state trooper accused of selling cocaine and fentanyl was ordered Monday to serve a year behind bars.

A judge sentenced Jeffrey Linscott, who was a trooper for 22 years and served in Iraq in the Army Reserves, under an agreement in which he pleaded guilty to a single count of trafficking cocaine.

Linscott choked up as his addressed law enforcement officers: "I'd like to apologize to the men and women in blue," he said.

Justice Roland Cole said Linscott should've known the danger of selling drugs because he'd likely been called to the scenes of overdose deaths when he was a trooper.

The drugs included fentanyl, a powerful opioid linked to an epidemic of overdoses in Maine. Linscott, of Buxton, was arrested in December after selling drugs to an informant working with the Maine Drug Enforcement Agency.

Defense lawyer Gene Libby said Monday that Linscott suffered from mental illness and post-traumatic stress disorder that contributed to his risky behavior and bad decisions.

The former homicide investigator began dealing drugs after having an affair with a woman who was addicted to drugs and spending his and his wife's life savings, Libby said.

Linscott's state pension of $3,447 a month is not affected by his conviction, Libby said.

The plea deal called for a four-year sentence but capped the amount of time in jail at 18 months. Prosecutors asked for a one-year sentence, while Libby argued for 60 days.

He will be required to report to jail on July 10. Then he'll be transferred to state prison.