A Michigan man arrested on drug- and weapon-related charges allegedly hid a loaded revolver inside his underwear while he was being booked at Cook County Jail on Christmas Eve.

Authorities discovered the five-inch, .22-caliber revolver with six live rounds when Jaetuan Poplar stepped into a body-scanning machine at the jail, Cook County prosecutors said Friday.

While Poplar was being scanned, a sheriff’s officer noticed “within the crotch area of body scan what appeared to be the handle to a handgun,” according to an incident report. Poplar, of Kalamazoo, Michigan, was then strip searched, but nothing else was found, the report said.

The Cook County Sheriff’s Department is conducting an investigation into how Poplar managed to get and conceal the weapon — especially since the 25-year-old was taken into custody by Berwyn police two days before the gun was discovered and had attended a bond hearing on other charges related to that matter on Tuesday.

Detainees are supposed to be physically searched and subjected to a metal detector during transfers, according to sheriff’s office spokesman Joseph Ryan, who added that Berwyn police had also been notified.

“While we are relieved the firearm was retrieved without incident, investigators are thoroughly reviewing what took place to help prevent such a situation from occurring in the future,” Ryan said.

Poplar was arrested Sunday on drug charges and for allegedly possessing .22-caliber ammunition in a bag without a valid Firearm Owners Identification card.

He was ordered released on his own recognizance for those charges during his bond hearing. But because he was wanted on an outstanding warrant for a robbery in Kalamazoo County, Michigan, he was also ordered held without bail and transferred into the sheriff’s custody.

After Tuesday’s hearing at the Maywood Courthouse and the gun was discovered at the jail at 2700 S. California Ave., Poplar was charged with possession of contraband in a penal institution.

At a hearing on the new charge Friday, an assistant public defender said Poplar, a father of two, was unemployed and didn’t have money to post toward his bond.

Judge Susana Ortiz ordered Poplar held on $30,000 bail and recommended electronic monitoring if he is able to post bond.

At the request of Poplar’s assistant public defender, Ortiz set Poplar’s next hearing for Jan. 3, so that his bail can be reviewed by another judge.