An illegal immigrant previously nabbed at the Texas border was arrested in Peabody this week on drug and fraudulent identity charges after police found a hidden stash of cocaine and heroin in the vehicle he was driving, a report states.

Juan Ramon Mateos-Avalos was charged with possession with intent to distribute a Class A substance (heroin), possession with intent to distribute a Class B substance (cocaine), fraudulently obtaining or use of a Massachusetts RMV document and giving a false name at booking, according to a police report.

Peabody police pulled Mateos-Avalos over at about 10:45 p.m. Tuesday, and, due to road conditions and cold, took him and the vehicle back to the police station for processing.

There, police located an “aftermarket hide,” or hidden compartment typically used to conceal drugs, weapons or cash from law enforcement, according to a police report. Officers report finding a portion of sheet metal near the rear passenger side had been cut from the body of the vehicle, a 2009 Nissan Rogue, and reattached with welds. A second area along the rear passenger frame had been modified as well, the report said. Officials said the hide was fairly sophisticated.

Officers found 27 bags containing about 17 grams of heroin, and 26 bags containing about 12 grams of cocaine, the police report said.

Mateos-Avalos was arraigned in Peabody District Court and was held on $150,000 cash bail. He is due back March 1 for a pretrial hearing, a court clerk said.

Based on an Immigration and Customs Enforcement- and FBI-endorsed class taught by Saugus police Officer James Scott called “Identifying the Imposter,” Peabody police said Mateos-Avalos had been using a fraudulent identity and had previously been charged with being an illegal immigrant.

Mateos-Avalos had been arrested by Customs and Border Protection in Texas on March 4, 2016, according to authorities. He then acquired a stolen identity and used it to obtain a Massachusetts driver’s license on Aug. 12, 2016, the police report states.

Police found the photos on the Puerto Rican license of the stolen identity did not match the photo on Mateos-Avalos’ Massachusetts license.

Peabody police Capt. Dennis Bonaiuto said fraudulent identities are becoming such a problem his chief is sponsoring training on how to identify them.

“It’s dangerous enough when they’re dealing with drugs and we don’t know what level of criminal history they have,” Bonaiuto said, adding it also makes it easier for suspects to skip out on bail.

Jordan Frias contributed to this report.