The former longtime chief probation officer for Suffolk superior court was sentenced to three to five years in prison on Friday on drug charges that occurred on the Vineyard.

Milton Britton Sr., 66, pleaded guilty in Dukes County superior court to possessing class B drugs (cocaine) with intent to distribute.

“This man was a probation officer for 30 years,” the Hon. Cornelius J. Moriarty 2nd said in court, after Mr. Britton’s lawyer asked for leniency. “He had to know the harm he was causing. He is not deserving of any leniency and he will get none from me.”

Mr. Britton was arrested in March 2011 after police executed a search warrant at his Oak Bluffs home and found more than 20 grams of cocaine, including drugs on Mr. Britton’s person and in a storage unit, district attorney Laura Marshard said. She added that he had been under investigation by the Martha’s Vineyard Drug Task Force for about two years.

His charge was amended from an earlier charge of drug trafficking.

Early Friday, Ms. Marshard and Mr. Britton’s lawyer, Robyn Nash, said they had worked out a deal for Mr. Britton to plead guilty in exchange for a two-and-a-half-year sentence, with 18 months served and the balance suspended for three years. Ms. Nash said Mr. Britton had been an “upstanding member of the community” with no prior brushes with the law before the arrest, and that he had cooperated with probation and voluntarily enrolled in a drug program after his arrest.

She said her client “started to use this substance and it got out of control.”

She added that Mr. Britton would likely lose his pension, which is “very painful for him.”

But Judge Moriarty rejected that deal, saying that as a former probation officer, Mr. Britton should have known that drugs are “a scourge” to society.

“As a probation officer you had to know that, up front, close and very personal,” he said.

He also rejected the idea that Mr. Britton had simply become addicted to the drug. “It does not sound to me that you got involved in this activity because you were addicted. It appears to me you were doing it for the profit,” Judge Moriarty said. “Which makes it all the more despicable, in my view.”

Ms. Nash asked for the court’s mercy. “My client is extremely remorseful for what has transpired,” she said.

Judge Moriarty said that argument fell on deaf ears.