A federal magistrate judge on Friday refused to order the pretrial release of Brian J. Cole Jr., who is charged with planting two pipe bombs outside the headquarters of the Democratic and Republican national parties on the eve of the Jan. 6, 2021, Capitol riot, according to court filings and prosecutors’ arguments. U.S. Magistrate Judge Matthew Sharbaugh rejected Cole’s bid for release, ruling that he must remain jailed while the case proceeds toward trial.

In the decision, Sharbaugh said there were no release conditions that could reasonably protect the public from the danger prosecutors say Cole poses. The judge’s ruling came as part of a detention dispute in federal court, after Cole was arrested last month.

Prosecutors told the court that Cole confessed to placing the pipe bombs outside the Republican National Committee and the Democratic National Committee headquarters only hours before a mob of President Donald Trump’s supporters stormed the Capitol on Jan. 6, 2021. Prosecutors also said Cole expressed that he hoped the explosives would detonate and that he wanted there to be “news about it,” court materials described by the Associated Press show.

In writing the ruling, Sharbaugh said he found the alleged plan could have produced devastating consequences if it had succeeded. Sharbaugh wrote, “Mercifully, that did not happen,” while warning that if the plan had worked, the results “could have been devastating,” including creating a greater sense of terror ahead of a high-security congressional proceeding and “grievously injuring DNC or RNC staff and other innocent bystanders, or worse.”

Cole’s arrest was tied to allegations that, after the Jan. 6 riot, he continued to purchase bomb-making components for months, prosecutors said. The filings also described that Cole told investigators the FBI that he planted the pipe bombs because “something just snapped,” and prosecutors said Cole believed someone needed to “speak up” for people who believed the 2020 election—won by Democrat Joe Biden—was stolen.

Cole’s attorneys asked Sharbaugh to release him on home detention with GPS monitoring. They argued in court that Cole does not have a criminal record and that he has autism spectrum disorder and obsessive-compulsive disorder, and they said he lives in a stable home shared with his parents in Woodbridge, Virginia. Defense attorneys also said the government’s purported risk was speculative and that Cole had lived at home with his family “without incident” over the preceding four years, according to the Associated Press account.

Prosecutors said Cole faces two charges, with potential prison time ranging up to 10 years on one charge and up to 20 years on the other. The second charge, prosecutors said, carries a five-year mandatory minimum prison sentence if convicted.

The judge’s ruling means Cole remains in custody as the case continues through pretrial proceedings, with the detention decision centered on whether any alternative to jail could ensure public safety given the nature of the allegations and what Sharbaugh characterized as the potential for recurrence.