A Cornish man has been arrested on a felony charge of selling crack cocaine, according to the Maine Drug Enforcement Agency.

Daniel Smith, 27, was charged with Class A aggravated trafficking in a Schedule W drug. His arrest on Friday was the result of a six-month-long investigation conducted by agents for the MDEA’s York District Task Force, which has been investigating the sale of crack cocaine, heroin and fentanyl by Smith throughout York County, the agency said in a news release.

Smith was still being held Sunday night at the York County Jail on $25,000 cash bail.

Smith’s car was stopped in Cornish for a traffic violation by police, who arrested him on a warrant for failure to appear in court.

During the arrest, officers found about 17 grams of crack cocaine and 2.8 grams of heroin, the MDEA said. After he was arrested, drug agents obtained a search warrant for his home.

During their search of his home on Maple Street, they seized 128 grams of crack cocaine, 2.5 grams of heroin, a semi-automatic handgun and $2,000 in suspected drug proceeds, the MDEA said. They also seized Smith’s 2008 Cadillac sport utility vehicle. The estimated street value of the crack cocaine and heroin is $15,500.

The Maine State Police K-9 unit and deputies form the York County Sheriff’s Office helped in the investigation.