A Rhode Island man who has already been arrested 40 times in two states faces a lengthy prison sentence after his 41st arrest.

Brandon Hayes, 30, of Central Falls, was in a car that was pulled over for traffic violations on Sunday on Interstate 95 in Warwick, state police Col. Steven O'Donnell said in a release.

The trooper performing the stop said Hayes, a passenger in the vehicle, had three bags of marijuana on his person. The trooper learned that as the vehicle was pulling over, Hayes removed a loaded handgun from his waist and put it under the passenger seat. The trooper recovered the 9mm pistol. Drug packaging material was found in the trunk, police said.

Hayes was charged with several drug offenses and with being a felon in possession of a firearm.

Hayes has a criminal history that includes 38 arrests in Massachusetts and two in Rhode Island, including gun and drug charges, state police said. He recently served 18 months behind bars for a 2012 assault conviction.

A federal judge ordered Hayes held without bail at his arraignment Monday. Attempts to reach him for comment Thursday were not successful. A phone call to a number listed for Hayes in Central Falls went unanswered. His federal defender did not immediately return a call.

If he is convicted on the latest gun charge, he faces up to 10 years behind bars.