ROCKLAND, Maine — A 29-year-old Rockland man was sentenced Tuesday to six months in jail after admitting to selling drugs to an informant working for the Maine Drug Enforcement Agency.

Anthony Raye pleaded guilty in Knox County Superior Court to three counts of trafficking in drugs. Justice Jeffrey Hjelm accepted the agreement reached between the defense lawyer and Maine attorney general’s office in which Raye would be sentenced to four years with all but six months suspended, two years probation and a $1,200 fine.

Assistant Attorney General Katie Sibley said that Raye sold oxycodone on two occasions and heroin on a third occasion to a cooperating individual working with the MDEA back in May in Rockland. The informant secretly recorded the transactions.

The sentence was in line with what others have received for similar offenses, Sibley said, adding that Raye immediately took responsibility.

Defense attorney Lawrence Frier said his client was selling those drugs because he owed money to a drug supplier and that supplier had made threats of violence if Raye did not pay the debt.

Justice Hjelm pointed out that Raye had no prior criminal offenses and that it was unusual for someone to go from no record to serving a six-month sentence. He said Raye made himself vulnerable by entering the world of drugs where the normal rules of society do not apply.

Raye also will have to pay $480 in restitution to MDEA for the money they provided for the drug buys.

He will begin his sentence Feb. 3.