ELLSWORTH, Maine — A local man has been ordered to serve four years behind bars after pleading guilty to charges of drug dealing and possession, according to documents filed in Hancock County Superior Court.

Matthew H. Wright, 33, was arrested in January 2013 when Maine Drug Enforcement Agency officers executed a search warrant at his Water Street home, where they found more than 330 bags of heroin packaged for retail sale, more than $2,000 cash, two handguns and 40 grams of a substance later identified as the hallucinogenic drug methylone. The heroin had a street value of more than $11,000, police said at the time.

Wright pleaded guilty last month in Hancock County Superior Court to charges of aggravated trafficking of scheduled drugs and possession of a synthetic hallucinogen, court documents indicate. He also admitted to three forfeiture charges that stemmed from the seizure of $2,141 in cash and the two handguns — a .38-caliber revolver and a .22-caliber pistol.

After pleading guilty, Wright received an overall sentence of 12 years in prison with all but four years suspended. He also was ordered to pay $515 in fines and fees and to serve three years of probation upon his release.

Story continues below advertisement.

According to Wright’s defense attorney, Jeffrey Toothaker of Ellsworth, Wright has been getting treatment and counseling since his arrest and has been doing well.

Toothaker said Friday that he asked Justice Ann Murray to impose a term of no more than seven months behind bars, and prosecutors asked for 15 years with all but seven years suspended. State law allows for some exceptions, Toothaker said, but otherwise requires a mandatory minimum unsuspended term of four years behind bars for an aggravated drug trafficking conviction.