A Mattapoisett man has been sentenced to three years in state prison after admitting to selling fentanyl.

Plymouth County District Attorney Timothy Cruz announced Friday that 31-year old John DeCosta III appeared in Brockton Superior Court on Wednesday, and entered guilty pleas on two counts of selling fentanyl.

DeCosta was picked up in July 2017, during a sweep by Mattapoisett Police investigating fentanyl distribution in the town.

DeCosta was arrested at a 7-11 store on Route Six after being observed carrying out a drug deal. Police said DeCosta was carrying more than $2,000 in cash and a small bag of fentanyl.

A search of his residence later uncovered another $1,900 in cash, a digital scale and plastic baggies.