[Sign up for the weekly At War newsletter to receive stories about duty, conflict and consequence.]

In their filing, prosecutors quoted a letter that he drafted to friends in 2017 and that the authorities found on his computer. In it, Lieutenant Hasson, who works as an acquisitions officer at Coast Guard headquarters in Washington, wrote: “I am dreaming of a way to kill almost every last person on the earth. I think a plague would be most successful but how do I acquire the needed / Spanish flu, botulism, anthrax not sure yet but will find something.”

In the last month, prosecutors said, the lieutenant used his work computer to draw up a list of prominent figures he called “traitors” and wanted to kill, including many well-known anchors and hosts on the CNN and MSNBC news networks and a number of Democratic elected officials. The list included, among others, House Speaker Nancy Pelosi, Representatives Alexandria Ocasio-Cortez and Maxine Waters, Senator Richard Blumenthal, whom he referred to as “Sen blumen jew,” and many of the senators running for president in 2020.

He had recently performed internet searches seeking information about whether senators and Supreme Court justices receive Secret Service protection, the court filing said.

[The number of hate groups in the United States rose for the fourth year in a row.]

On Thursday, Senator Blumenthal told CNN that the authorities had not warned him that his name appeared on the list. “I found out from the news when I heard about it last night,” he said.

In the letter quoted by prosecutors, Lieutenant Hasson wrote about wanting to start a race war, and pondered the best way to do it. “Much blood will have to be spilled to get whitey off the couch,” he wrote.