BRUNSWICK, Maine — A 42-year-old Brunswick man was arrested Monday afternoon after allegedly bringing heroin into the state.

Justin Ryan was charged with Class A aggravated trafficking in heroin, according to a news release by the Maine Drug Enforcement Agency.

For the past month, agents from the MDEA Mid-Coast District Task Force and investigators from the Sagadahoc County Sheriff’s Office conducted an investigation into the illegal distribution of heroin by Ryan throughout the Bath/Brunswick area, according to the MDEA.

At about 2:30 p.m. Monday, agents requested a vehicle driven by Ryan be stopped by Brunswick police on Pleasant Street. Agents had developed information that Ryan was returning from Massachusetts with a large amount of heroin. Forty grams of heroin were found in the center console of Ryan’s vehicle, according to the MDEA.

Ryan was arrested and taken to the Cumberland County Jail in Portland where bail was set at $25,000 cash. At the time of his arrest, Ryan was out on bail on charges of heroin possession and trafficking in Massachusetts in 2014.

After Ryan’s arrest, agents served a search warrant at his Dunning Street apartment, where they seized items such as scales and packaging materials believed to be used in drug trafficking, as well as $1,300 in suspected drug proceeds, according to the MDEA.

The estimated street value of the seized heroin is $10,000 dollars, according to the MDEA.

Assisting in the investigation and arrest were officers from the Sagadahoc County Sheriff’s Department and the Bath and Brunswick police departments.