NEW YORK (Reuters) - Authorities alerted by a Walmart worker arrested a former Cornell University student accused of stockpiling a semi-automatic rifle, more than 300 rounds of ammunition, bomb-making materials and other deadly devices at his apartment near the upstate New York elite school.

Maximilien Reynolds, 20, of New Jersey, a one-time student at the Ivy League school in Ithaca, New York, now enrolled at a local community college, was federally charged with possession of an unregistered destructive device and a silencer as well as making false statements to acquire a firearm.

A Walmart employee contacted authorities after Reynolds used a gift card at the Ithaca store to buy ammunition, camping gear, drill bits, hacksaw blades, knives and other “suspicious” items, according to a criminal complaint filed on Friday.

Initially let into the apartment by Reynolds’ girlfriend, authorities found a cache of high-capacity ammunition magazines, a semi-automatic MSR-15 Patrol rifle, a homemade silencer, bullet-resistant vest, gas mask, fireworks rigged with shrapnel and other explosive materials, according to the complaint.

The home itself was filled with piles of clothing, food and laboratory glassware, investigators recorded.

“What appeared to be mathematical writings were written on the west facing windows of the apartment in red ink,” said an affidavit filed with the complaint.

The discovery came just over a month after a gunman killed 17 people at a high school in Parkland, Florida.

Reynolds was previously known to authorities who detained him in June 2016 under a section of New York Mental Hygiene Law that lets police take a person who appears mentally ill to a hospital, according to the affidavit.

After authorities searched his apartment on Thursday, Reynolds voluntarily agreed to be taken to Cayuga Medical Center for a psychiatric evaluation, the affidavit said.

Reynolds told investigators the rifle was bought on his behalf by a man identified only as “A.R.” who he paid $1,200, the affidavit said. Reynolds said he was prohibited from buying it himself.

Aside from the stash in his apartment, Reynolds also used two rented self-storage units to accumulate “pre-cursor chemicals frequently used in the manufacture of homemade explosives” as well as “smokeless powder, a consumer firework mortar round and pyrotechnic fuse,” the affidavit said.

After Reynolds was taken into custody, Cornell Police Chief Kathy Zoner said there was no threat to the campus or to the surrounding neighborhood, known as Collegetown.