Officials say Mark Domingo was arrested as he finalised plans for an attack to ’cause the maximum number of casualties’.

A US veteran of the war in Afghanistan, who prosecutors say plotted to detonate a bomb at a Los Angeles area rally causing mass casualties, has been taken into custody following an FBI online sting operation, federal prosecutors said on Monday.

Mark Steven Domingo, 26, a US Army infantryman who served time in Afghanistan and later converted to Islam, was taken into custody on Friday after being given what he thought was a live explosive device to use in the attack, federal prosecutors said in a written statement.

“This investigation successfully disrupted a very real threat posed by a trained combat soldier who repeatedly stated he wanted to cause the maximum number of casualties,” federal prosecutor Nick Hanna said in the statement.

According to prosecutors, Domingo was arrested while finalising plans to plant a bomb at a white supremacist rally scheduled for Sunday in Long Beach. Court papers show that Domingo also discussed with an informant different types of attacks that included targeting Jews, churches and police officers.

Domingo allegedly said he wanted revenge for the attacks on two mosques in New Zealand that killed 50 people last month.

Faces 15 years in prison if convicted

Domingo was charged in a federal criminal complaint with providing and attempting to provide “material support to terrorists” and was scheduled to make an initial appearance in US District Court in Los Angeles later on Monday. It was not immediately clear if he had retained a lawyer.

Prosecutors said that in online conversations with an undercover FBI source, Domingo expressed willingness to become a “martyr”.

In an FBI affidavit filed in the case, Domingo said he specifically purchased three-inch nails because they would be long enough to penetrate the human body and puncture internal organs.

He could face a maximum sentence of 15 years in federal prison if convicted of all of the charges.

The announcement comes two days after a gunman opened fire in a San Diego-area synagogue, killing one person and wounding three others in what officials have described as a “hate crime”. A suspect identified as John Earnest, 19, was taken into custody in the shooting.

There was no indication that the two incidents were connected.