A Maryland man pleaded guilty to weapons and child pornography charges Monday after a raid of his bunker last year uncovered a cache of firearms, explosives and other illicit materials.

Caleb A. Bailey, 31, of Waldorf pleaded guilty to illegal possession of unregistered machine guns, rifles, destructive devices and child pornography in federal court, according to a statement from the U.S. attorney’s office in Maryland.

Bailey ran as a delegate for Donald Trump before the Republican National Convention and was one of three top vote-getters in the race in Maryland’s 5th Congressional District, said officials with the Maryland Republican Party, when an indictment was announced in May 2016.

The case against Bailey began when a package filled with hundreds of rounds of ammunition burst at a U.S. postal facility in Capitol Heights, Md., a court affidavit states.

Investigators said Bailey had attempted to ship ammunition through the mail without a proper permit. Authorities linked Bailey to the package after he had called postal employees to inquire about the undelivered package and traced his payment card to the shipping fee, the federal government said.

[Maryland man indicted on charges of child porn, weapons offenses]

The Bureau of Alcohol, Tobacco, Firearms and Explosives searched Bailey’s home and found an underground bunker stocked with guns, explosives, covert recording devices and hundreds of images depicting child pornography, according to the statement from the U.S. attorney’s office. Investigators said Bailey secretly recorded people in the bathroom of his RV and Maryland hotels, some of whom he had stayed with while competing in ATV races, the government states.

Bailey is set to be sentenced in November and faces 10 to 27 years in prison.

Justin Wm. Moyer and Ovetta Wiggins contributed to this report.