Two Boston men are facing charges of drug trafficking after police arrested them Tuesday with almost five pounds of heroin, according to authorities.

Jorge Luis Mendez-Baez, 26, of Mattapan and Luis Medina-Feliciano, 40, of the South End were arraigned on Wednesday in Chelsea District Court.

RELATED: Boston man charged with heroin, crack distribution

Mendez-Baez was charged with distribution of a Class B substance, trafficking in more than 200 grams if the substance, three counts of trafficking in a Class A substance, and conspiracy to violate the state’s drug law. Medina-Feliciano was charged with distribution as a second or subsequent offense, trafficking and conspiracy to violate the state’s drug laws.

Authorities arrested both men on Tuesday after they allegedly sold more than 200 grams of heroin to an undercover state trooper during a single transaction.

During his arrest, Medina-Feliciano had an extra 17 baggies of a substance believed to be heroin on his person, prosecutors said.

Following the arrests, state and Boston police executed search warrants at Baez’ home on Orlando Street and Medina-Feliciano’s home on West Newton Street, according to authorities. There they recovered more than two kilograms of a substance believed to be heroin and/or fentanyl, a white powder believed to be a cutting agent, and a Sig Sauer P223 .22 caliber semiautomatic handgun.

“When opiate overdoses in Suffolk County claim more than three times as many lives as illegal firearms, we can’t pretend that heroin trafficking is a victimless crime,” said Suffolk County District Attorney Daniel F. Conley. “When police recover a handgun next to several pounds of narcotics, we can’t pretend that a drug trafficker is a nonviolent offender. This was careful, methodical work to disrupt a high-level narcotics distribution group, and it could very well save lives in Boston and beyond.”

The investigation behind these arrests began on October 2015, when State Police successfully introduced an undercover trooper to Baez, according to prosecutors. That trooper purchased “trafficking-weight quantities” of heroin and fentanyl from him four times.

RELATED: Mass. pro-pot activist speaks out on drug charges

State Police detectives also learned that Boston Police Drug Control Unit detectives had an investigation into Medina-Feliciano, who was closely associated with Baez’ distribution operation, authorities said.

Warrants were also obtained by authorities to perform audio and video recording of the undercover drug transactions.