As Ethan Melzer’s Army unit prepared to deploy in April, the young private recognized that he could be killed while overseas and expressed an apparent willingness to die.

“I would’ve died successfully,” he allegedly wrote in a message.

But federal authorities now say that Melzer’s life was actually at risk because of a murderous plot he had hatched against his own unit.

Melzer, a 22-year-old from Louisville, is accused of leaking sensitive information about his unit to a satanic neo-Nazi cult as part of a plot to launch a “mass casualty” attack intended to cause “the deaths of as many of his fellow service members as possible,” according to an indictment unsealed Monday.

In electronic messages, Melzer allegedly shared details about his unit’s location, movements and security with members of the Order of Nine Angles, or O9A, an organization based in the United Kingdom and described by prosecutors as “an occult-based neo-Nazi and racially motivated violent extremist group.”

“Melzer allegedly provided this potentially deadly information intending that it be conveyed to jihadist terrorists,” Audrey Strauss, acting U.S. attorney for the Southern District of New York, said in a news release.

Describing the planned attack as a “murderous ambush,” Strauss called Melzer “the enemy within,” adding that he was “motivated by racism and hatred as he attempted to carry out this ultimate act of betrayal.”

Melzer, whose alleged plans were thwarted by the FBI and the Army late last month, was arrested on June 10 and has been charged with conspiring and attempting to murder U.S. nationals, conspiring and attempting to murder military service members, providing and attempting to provide material support to terrorists, and conspiring to murder and maim in a foreign country, according to the release.

Authorities said Melzer admitted to plotting the assault against an unidentified military base. While in custody, he declared himself “a traitor against the United States” and said his conduct was “tantamount to treason,” the indictment said. If convicted, Melzer could face up to life in prison.

Jennifer E. Willis, an attorney representing Melzer, told The Washington Post early Tuesday that she has “no comment at this time.”

The charges against Melzer are likely to renew concerns about white nationalist and extremist influences within the U.S. military amid an increase in violence linked to right-wing fringe movements. In the United States, for example, followers of the “boogaloo boys” have recently been charged with murder and accused of attempting to incite violence at the largely peaceful demonstrations against police brutality.

In April, the U.N. Counter-Terrorism Committee Executive Directorate published a report citing research that there has been a 320 percent rise in terrorist attacks with links to such movements and ideologies over the past five years. There is a “growing and increasingly transnational threat posed by extreme right-wing terrorism,” the report said, noting that the attacks have been intensifying in both frequency and lethality.

Federal prosecutors said Monday that members and associates of O9A, the group Melzer was allegedly involved with, have been known to participate in acts of violence, including murder.

O9A promotes “violent, neo-Nazi, anti-Semitic and Satanic beliefs,” and its adherents have expressed admiration of Adolf Hitler and Islamic terrorists such as Osama bin Laden, prosecutors said. Earlier this year, government officials in Britain faced pressure from activists to outlaw O9A as a terrorist organization, the BBC reported.

The group, which intertwines Satanism, paganism and Nazism to create a “bizarre pseudo-religious political cult,” is believed to have originated in the early 1970s, according to Hope not Hate, an anti-hate advocacy organization in the United Kingdom. As Hope not Hate writes, O9A “encourages acolytes to engage in forbidden and illegal acts, including extreme violence, sexual assault, assassinations and human sacrifices.” More recently, O9A has gained prominence online, allowing its propaganda to be easily accessed by “young radicals drawn to extreme fringe ideas,” the advocacy group noted.

Federal authorities did not specify how Melzer, who joined the Army in 2018, became involved with O9A, saying only that he was affiliated with the group by 2019. That same year, Melzer and his unit were deployed abroad, the indictment said.

Before planning the attack, Melzer consumed propaganda from O9A and the Islamic State (ISIS), authorities said. FBI agents said that during their investigation, they discovered an ISIS document stored in Melzer’s iCloud account that mentioned the “HARVEST OF THE SOLDIERS” and described the attacks and killings of U.S. service members.

The plot to kill his fellow soldiers allegedly began to take shape in April, after Melzer learned that his unit was being moved to a different foreign base, according to the indictment.

Prosecutors allege that once he was notified of the assignment, Melzer used an encrypted application to message members of O9A and a related group known as the RapeWaffen Division. The messages allegedly contained conversations about Melzer’s commitment to O9A and the specifics of his unit’s upcoming deployment, including the number of soldiers who would be traveling, where they would be going and details about their location’s surveillance and defensive capabilities. Authorities allege that Melzer also promised to share more details of his new base after he arrived “to try to maximize the likelihood of a successful attack on his unit.”

In one message in May, Melzer passed along information about the deployment to a purported member of al-Qaeda, the indictment said. About a week after, Melzer messaged an O9A chat group, allegedly writing that he was “risking [his] literal free life” by leaking the information and was “expecting results.” He also suggested that the assault, which authorities say Melzer and O9A members called a “jihadi attack,” would start a “new war.”

Melzer acknowledged in later messages that he knew the planned attack could result in his death, but wrote, “who gives a f---,” adding, “I would’ve died successfully … cause another 10 year war in the Middle East would definitely leave a mark.”

On Monday, federal prosecutors accused Melzer of attempting to carry out the deadly attack “in service of a diabolical cocktail of ideologies laced with hate and violence.”

“Our women and men in uniform risk their lives for our country, but they should never face such peril at the hands of one of their own,” said John C. Demers, the assistant attorney general for national security.