Former trooper Gregory Raftery, possibly the worst offender in the Massachusetts State Police overtime scandal, was sentenced to three months in federal prison Tuesday morning ― the first going to prison in the scam that included nearly 50 troopers.

Judge William G. Young ordered Raftery to report to the U.S. Bureau of Prisons on April 9 to serve 90 days in prison, followed by a year of supervision. Raftery also must pay a restitution of $51,337, the amount of money he made for overtime hours he skipped.

Raftery, 48, of Westwood, pleaded guilty in July to one count of embezzlement from an agency receiving federal funds. He not only wrote fake tickets for overtime hours he skipped, but also destroyed copies of those citations to cover up his misdeeds, according to the sentencing memo.

The now-retired state police trooper admitted to skipping more than 100 specialized patrol shifts in 2015 and 2016, pocketing $51,337 for overtime hours he didn’t work.

“The crime here is so extensive, so sophisticated, motivated by nothing but greed, it is the view of this court that you must spend a short time in prison,” Young told Raftery in federal court Tuesday morning.

Raftery delivered a tear-filled apology Tuesday morning, saying he has to regain the trust of his family and friends as well as the people of Massachusetts.

“I know what I did was wrong, and I’m truly sorry for that,” Raftery said, adding that he hopes people don’t judge other police officers for his misdeeds.

He was one of nearly 50 troopers tied to the overtime scandal, according to an internal audit conducted by the Massachusetts State Police. Authorities say the members of the now-disbanded Troop E earned thousands of dollars for overtime hours they did not work on the Accident Injury Reduction Effort patrols, or AIRE, the specialized overtime patrols on the Massachusetts Turnpike.

But Raftery may have been the worst offender. Sources told MassLive that Raftery appears to be the only trooper who skipped triple-digit AIRE shifts.

Raftery spent part of his regular shifts taking down license plate numbers on cars that passed him on the Massachusetts Masspike. He cited those in the tickets he claimed to have given out during the overtime shifts he skipped, authorities said.

The sentencing guidelines called for 12 to 18 months in prison, according to Raftery’s sentencing memo. U.S. Attorneys Mark Grady and Dustin Chao recommended a 6-month prison sentence, followed by a period of supervised release and restitution.

16 Massachusetts State Police overtime scandal

Raftery’s attorney, Thomas Butters, said he hopes the judge considers multiple factors in the case, including Raftery’s service in the 20-plus years he spent in the Massachusetts State Police. Then he asked to approach the judge’s bench and spoke with Young and prosecutors quietly about his client’s circumstances.

It is unclear what they discussed, but it didn’t seem to be enough to dissuade Young from ordering prison time. “I’ve got to send you to jail,” Young said.

Raftery’s sentencing triggers a review by the state retirement board. Raftery retired last year and receives a monthly payment of $6,017.07.

Raftery is the second trooper sentenced in connection with the overtime investigation. Eric Chin, a former trooper who was fired last year, was sentenced to three months of house arrest, followed by nine months of supervised release.

Eight troopers were charged with embezzlement in federal court. All of them have pleaded guilty. Three troopers are also facing state charges. Lt. David Wilson is the only trooper in the group who is facing both state and federal charges.