A man accused of making bombs and who was taken into custody after a standoff with police outside his South Jordan home has been charged with multiple felonies.

Ryan Lynn McManigal was charged with two counts of first-degree felony attempted homicide/aggravated murder and three counts of first-degree felony use of a weapon of mass destruction.

Court documents filed Wednesday in 3rd District Court also reveal how many explosives were found in the 42-year-old man’s house and how one nearly detonated as police tried to take the suspect into custody.

Police began investigating McManigal on July 18, six days before the standoff. South Jordan officers were called to a Culver’s restaurant on South Jordan Parkway after he texted threats to the business owner, according to a probable cause affidavit. McManigal was upset at the business, which is located just south of his home, asserting “that Culver’s is harassing him and harassment is the reason mass shootings occurred.”

In charging documents, McManigal is reported to have said he could have “snapped and walked into the building to mow down staff and customers.”

An officer texted with McManigal, and said that McManigal admitted to having weapons in his home, despite being the subject of a protective order and being legally barred from having them.

Officers got a search warrant, and arrived at McManigal’s house in an armored truck, court documents say. A police lieutenant was on the phone with McManigal at the time, and reported that McManigal told him to, “[h]ave a rethink,” before he allegedly began shooting at the armored vehicle.

An officer recalled hearing the police inside the vehicle yelling out, wondering how many more bullets the vehicle could take. It was hit 13 times, breaching the man’s house, before McManigal came out of the house to surrender, calling out, “Stop breaking my s---. I’m coming out.”

Police found 20 pounds of explosives — Triacetone Triperoxide, or TATP, and Methyl Ethyl Ketone Peroxide, or MEKP — in the home and what appeared to be detonation devices in a gift box, a toilet valve with a water-level activated switch and several remote control cars. Officials allege McManigal first began making the explosives in February.

Three firearms and thousands of rounds of ammunition were also in the house, documents say.

McManigal allegedly told police that he intended to detonate the explosives inside a refrigerator by firing a gun at it. However, documents allege, the gun jammed when he tried to fire. That’s when documents allege McManigal surrendered.

A bomb expert told police that TATP and MEKP are highly volatile and have about a 1,000-foot blast radius, which is why authorities evacuated some 600 homes and 30 businesses in the neighborhood on July 24 before they exploded the material.

Court documents don’t list an attorney for McManigal, so The Salt Lake Tribune was unable to reach out for comment.

McManigal remains in Salt Lake County jail without the option to post bail, records show.