A federal judge ordered a U.S. Coast Guard lieutenant accused of plotting a widespread terrorist attack to remain in jail pending trial, overturning an earlier magistrate judge’s decision to release Christopher Paul Hasson on home arrest.

The decision Monday came in a hearing in U.S. District Court in Maryland, where prosecutors and Hasson’s public defender clashed for the fourth time over whether Hasson should stay in jail if he faces drug and weapons charges but no terrorism-related offenses.

Although the charges Hasson faces are “unremarkable,” U.S. District Court Judge George J. Hazel said, Hasson’s “history and characteristics” and potential danger to the community weighed in favor of blocking release.

The evidence the government brought showed specific alleged actions toward a plan, Hazel said. Hasson’s alleged actions of amassing weapons, creating a target list of enemies and researching their locations ramped up after he started studying the manifesto of a Norwegian terrorist who killed 77, Hazel said.

The evidence shows Hasson allegedly “intended to use these items to commit a series of violent acts,” Hazel said, noting the 15 firearms and 1,000 rounds of ammunition seized from Hasson’s home.

Hasson, 50, of Silver Spring, was arrested in February. Investigators found an arsenal in his basement apartment and a list of targets on his computer that prosecutors assert were part of a planned mass killing driven by his self-professed white-supremacist views.

Hasson has pleaded not guilty. His public defenders have said the government cannot prove Hasson had specific plans for an attack and called the allegations “sweeping, dramatic rhetoric.”

In a motion to the court filed Friday ahead of arguments to Hazel, Assistant U.S. Attorney Thomas Windom said the government “has no doubt” that Hasson’s arrest prevented a “mass casualty event.”

In court Monday, Windom displayed some of the weapons the government says Hasson modified to make it easier to attack. Windom also said Hasson lied about living in Virginia to purchase weapons faster and some weapons Hasson once appeared to have possessed remain “unaccounted” for.

It’s “very scary that there’s other weapons out there that the government doesn’t know about,” Windom said.

Hasson’s case is challenging for prosecutors, experts say. Federal laws addressing material support for terrorism revolve mostly around foreign groups such as the Islamic State. But because there isn’t a domestic terrorist list, the government is limited when dealing with the charges it can bring. Domestic terrorism suspects are typically charged on nonterrorism offenses to remove perceived threats.

But Hasson’s federal public defender Liz Oyer said the government could have charged her client with stalking, attempted murder or other offenses outside of terrorism. Oyer said the government’s failure to bring other more serious charges shows prosecutors cannot prove specific evidence of a plot and are working off a “gut feeling.”

“The government has a lot of tools at its disposal to deal with a case like this,” Oyer said.

Last week, U.S. Magistrate Judge Charles B. Day ruled that Hasson should be released on home detention to the Virginia house of his wife’s parents on GPS monitoring and other strict bail conditions. But the release was immediately blocked after the government filed an appeal, which Hazel ruled on Monday. Hazel will be presiding over Hasson’s trial.

In detaining Hasson, Hazel said there were “very clear connections” between Hasson’s actions and Hasson’s reading of a manifesto penned by Norwegian mass attacker Anders Breivik.

“It may be an odd thing to read, but it’s not an unlawful thing to read,” Oyer said.

The Coast Guard has said Hasson’s alleged plot was detected when an internal program that watches for any “insider threat” detected suspicious activity on Hasson’s work computer.

Court documents filed Friday assert that on a Thursday in February 2018, Hasson spent hours using his Coast Guard computer to search for information on Hitler, Nazis and how many Jewish people live in the United States, prosecutors said in court documents. Later that night on his personal device, according to the government, he browsed firearm sales websites and the distances at which a certain rifle could “kill.”

Similar searches, the government asserts, occurred in the following days: “how to rid the us of jews,” “rifle ranges near me” and “how can white people rise against the jews.”

Hasson also researched how to make homemade bombs, studied sniper training manuals and looked into whether certain bullets would be “untraceable,” the government asserts.

In writings the government seized, Hasson called himself a longtime white nationalist and skinhead and said he was “dreaming of a way to kill almost every last person on earth,” according to court documents.

“ . . . the manifestos of those who came before the defendant — those who attacked children in Norway, tourists at the Atlanta Olympics, and worshippers in the Pittsburgh synagogue and New Zealand mosques — also were unshared, private thoughts,” Windom wrote, “until those plans turned to action.”