A Gorham man who was caught in a federal wiretap investigation into drug dealing was sentenced Monday in U.S. District Court to serve 70 months in prison on cocaine and firearms charges.

Richard Magee, 58, came under investigation by the U.S. Drug Enforcement Administration in August and September 2013 after agents discovered he was bringing cocaine from out of state to sell in Maine, according to court records.

After intercepting several phone calls in September 2013 between Magee and now-convicted drug dealer David Jones as they conducted drug sales, federal agents searched Magee’s home at 297 County Road in Gorham on Oct. 2, 2013. Agents found five guns in Magee’s bedroom and a cocaine processing station in his basement, according to court records and the U.S. Attorney’s Office.

Magee had been convicted in federal court in California of felony money laundering, so he was prohibited from possessing firearms.

Magee pleaded guilty on Oct. 29 in a plea agreement in which he was convicted of one count of being a felon in possession of a firearm, three counts of distribution of cocaine and one count of possession of cocaine with intent to distribute. Under the terms of the agreement, other charges were dismissed, including witness tampering, conspiracy to tamper with a witness and use of a communication facility in a drug crime.

Judge George Singal also sentenced Magee to serve three years of supervised release when he completes his prison term.