NEW YORK (Reuters) – A U.S. Army private who according to federal prosecutors confessed to his role in plotting a deadly attack on his own military unit pleaded not guilty to charges he shared secret information about the unit with a neo-Nazi group.

Ethan Melzer, 22, entered his plea on Monday before U.S. Magistrate Judge Sarah Netburn in Manhattan, at a hearing conducted electronically.

The U.S. Department of Justice accused Melzer of using an encrypted app to send his unit's planned movements to members of the Order of Nine Angles (“O9A”), which it described as “an occult-based neo-Nazi and white supremacist group,” and a related group called the “RapeWaffen Division.”

Calling Melzer “the enemy within,” prosecutors said the Louisville, Kentucky, resident hoped to cause mass casualties through what he and co-conspirators labeled a “jihadi attack.”

Melzer enlisted in the Army in 2018, joined O9A in 2019, and began planning the attack in April after learning of a new foreign deployment for his unit, prosecutors said.

The plot was foiled in late May, and Melzer was arrested on June 10, they added.

Federal public defenders representing Melzer did not immediately respond to requests for comment after the hearing.

Melzer is being held at the Metropolitan Correctional Center in Manhattan.

Related: Soldier accused of planning attack on his own unit, giving classified info to Neo-Nazi group

Prosecutors said Melzer admitted his role in plotting an attack in a voluntary May 30 interview with military investigators and the FBI.

Melzer said in that interview he intended to cause the deaths of as many fellow service members as possible, declared himself a traitor against the United States and likened his conduct to treason, prosecutors said.

The defendant faces six charges, including conspiring to murder U.S. nationals and conspiring to murder U.S. military personnel, each of which carries a maximum life sentence, and providing material support to terrorists.

The case is U.S. v. Melzer, U.S. District Court, Southern District of New York, No. 20-cr-00314.