A New Jersey man was arrested Wednesday on terror-related charges for allegedly seeking to provide material support to Hamas, and discussing the bombing of Trump Tower and the Israeli consulate in Manhattan, according to federal officials.

Jonathan Xie, 20, of Basking Ridge, is charged with two counts of attempting to provide material support to a designated terrorist organization, two counts of making false statements, and one count of transmitting a threat in interstate commerce.

He is scheduled to appear Wednesday afternoon before US Magistrate Judge Mark Falk in Newark federal court.

Xie also is accused of lying on his application to join the US Army and of making threats against pro-Israel groups, officials said.

According to federal documents, Xie appeared in an Instagram Live video in April wearing a black ski mask and claiming that he was against Zionism and the neo-liberal establishment.

When asked by someone in the video if he would go to Gaza and join Hamas, Xie replied, “Yes, if I could find a way.”

Later in the video, he displayed a Hamas flag and brandished a handgun.

“I’m gonna go to the [expletive] pro-Israel march and I’m going to shoot everybody,” he said, according to the complaint.

In subsequent postings, Xie stated: “I want to shoot the pro-israel demonstrators … you can get a gun and shoot your way through or use a vehicle and ram people … all you need is a gun or vehicle to go on a rampage … I do not care if security forces come after me, they will have to put a bullet in my head to stop me.”

In December 2018, Xie sent $100 via Moneygram to a person in Gaza whom he believed to be a member of the Al-Qassam Brigades, the military wing of Hamas, to include suicide bombings against civilian targets inside Israel.

He then posted on his Instagram account: “Just donated $100 to Hamas. Pretty sure it was illegal but I don’t give a damn.”

In April, the suspect sent a link to a website for the Al-Qassam Brigades to an undercover FBI worker and described it as belonging to Hamas, officials said.

Xie sent screenshots of the site to the FBI worker and demonstrated how to use a new feature that allows donations to be sent via Bitcoin. He then sent a donation of about $20 in Bitcoin via the website as a test to see whether the site’s feature worked.

In February, Xie said he wanted to join the US Army “to learn how to kill… So I can use that knowledge.”

“Idk [I don’t know] if I pass the training…If I should do lone wolf.That is why I have to learn military techniques from the Army …,” he said.

He also completed the Security Clearance Application for National Security Positions, where he answered “No” to the question “Have you EVER associated with anyone involved in activities to further terrorism?”

The probe revealed additional social media accounts for Xie, including a YouTube account that contained a playlist containing videos, many of which promoted Soldiers for Allah, the war in Syria, Hezbollah, the Houthi movement in Yemen, as well as support for Syrian President Bashar al-Assad and North Korea.

After being observed by the FBI outside Trump Tower in April, Xie posted two images on his Instagram account — one with the words “I want to bomb Trump Tower” imposed over the building and the other with the words “[S]hould I bomb Trump Tower,” a “Yes/No” poll, and an emoji of a bomb imposed over the image.

“Okay, so I went to NYC today and passed by Trump Tower and then I started laughing hysterically … s— I forgot to visit the Israeli embassy in NYC … i want to bomb this place along with trump tower,” he wrote.

“Homegrown violent extremists like Xie are a serious threat to national security,” US Attorney Craig Carpenito said in a statement. “The actions that he took and planned to take made that threat both clear and present, and we commend our law enforcement partners for working closely with us to stop him before he could carry out his plans to commit violence on American soil.”