Image copyright Google Maps Image caption Prosecutors say that Mustafa Mousab Alowemer plotted to attack a Pittsburgh church

A 21-year-old Syrian refugee has been arrested by the FBI for allegedly plotting to bomb an African-American church in Pittsburgh, Pennsylvania.

Mustafa Mousab Alowemer - who came to the US from Daraa, Syria, three years ago - is charged with leading an Islamic State-inspired plot.

As Mr Alowemer collected bomb-making materials, he was in contact with an undercover FBI agent, detectives say.

The FBI says he recorded a video of himself pledging allegiance to IS.

In one message on social media to an FBI agent, he allegedly wrote in Arabic "I'm burning from inside for what happened to the Muslims in New Zealand", a reference to the 15 March attack on two mosques in Christchurch.

He also discussed targeting individual US soldiers, a local Yazidi community and a Shia mosque, according to investigators.

"Targeting places of worship is beyond the pale, no matter what the motivation," Assistant Attorney General John Demers said in a statement announcing Wednesday's arrest.

"The defendant is alleged to have plotted just such an attack of a church in Pittsburgh in the name of ISIS."

Court documents show that Mr Alowemer wanted to plant a bomb in the middle of the night at the Legacy International Worship Center.

He said the church was chosen for attack in order to "take revenge for our ISIS brothers in Nigeria", according to the criminal complaint.

In a statement on Facebook, Pastor Michael Day of the Legacy International Worship Center praised the arrest, writing: "The Devil is Defeated and God is Exalted!"

"Gratefully God thwarted such a strategy, protecting our congregation and northside community," he said, adding that the community would need time to "digest this horrific news".

Prosecutors say Mr Alowemer had written a "10-point handwritten plan" in which he discussed delivering the bomb using his backpack. He had also allegedly printed out satellite pictures of the church from Google in order to plot escape routes.

Earlier this month he purchased batteries, nails and other household items that he hoped to fashion into a bomb, officials say.

He also sent bomb-making propaganda to an FBI contact who he thought was a fellow IS sympathiser who would help him build an explosive.

Mr Alowemer arrived in the US as a teenager and graduated from an American high school, the FBI says. But he does not hold a US passport.

Trump hails fall of IS 'caliphate'

President Donald Trump has banned migration from Syria and other countries prone to terrorism, citing a danger to Americans.

The travel ban was challenged in court but eventually upheld by the Supreme Court, which acknowledge the president's power to control national security policy.