A Massachusetts man was arraigned Saturday on drug-trafficking charges, following his arrest by Brattleboro police Thursday after a gun went off inside his motel room, leading police to discover a large quantity of drugs.

Jeremiah Ahearn, 25, of West Springfield, Mass., was charged with reckless endangerment, trafficking fentanyl and possession of cocaine after police officers executed a search of his room at a Putney Road motel, according to a news release from the Brattleboro Police department.

Around 11:30 p.m., the department responded to a call about a gunshot at the motel, which originated in Ahearn’s room, according to police. The bullet pierced a wall and entered the next room, which was occupied, the release said; however, no one was injured.

The search turned up large amounts of both fentanyl and cocaine, as well as a firearm, according to police reports. Ahearn was taken into custody without incident.

He was arraigned in the Windham Criminal Division of Vermont Superior Court Saturday and held on $50,000 bail.

Mia Summerson can be reached at 352-1234, extension 1435, or msummerson@keenesentinel.com. Follow her on Twitter @MiaSummerson