A teenager has appeared in court after allegedly threatening Israeli President Isaac Herzog ahead of his contentious visit to Australia.

Darcy Tinning, 19, was accused of threatening to shoot the head of state with a pistol and kill US President Donald Trump in a January 19 post on social media platform X.

His threat to Herzog included a violent remark referencing extinction, which federal prosecutors said constituted hate speech and risked inciting others with similar views.

The Newtown man was arrested on Wednesday and brought before a Sydney court on Thursday.

Given the Israeli president is set to arrive in Australia on Sunday, the prosecutor said the teen posed a risk to the community due to the violent nature of the threats.

A rally protesting Isaac Herzog's visit (file image)
Isaac Herzog’s planned visit to Australia has drawn criticism from pro-Palestine groups. (Jay Kogler/AAP PHOTOS)

She noted the threat to Herzog was made amid heightened tensions after the Bondi terror attack in December.

“The current heated climate, the unrest in the community, makes the threats very serious,” the prosecutor said.

“Unacceptable risks exist which cannot be mitigated if the defendant is released in this climate of political unrest.”

Tinning’s lawyer, Brendan Green, accepted his client’s comments were “completely inappropriate” and could result in significant jail time, but stressed they were not directed at any particular people or group.

There was no real suggestion the teen would follow through on the threats, he said.

Neither Tinning nor his family have any access to firearms and he does not have a history of violence, Green told the court.

Israel’s president was controversially invited to Australia by Prime Minister Anthony Albanese after gunmen opened fire on a Hanukkah event at Bondi Beach, killing 15 people on December 14.

People protest against Isaac Herzog's upcoming visit (file image)
Rallies are planned in every capital city to protest against Isaac Herzog’s visit. (Callum Godde/AAP PHOTOS)

During the five-day trip, he will meet with survivors of the terror attack, senior Australian politicians and Jewish community leaders.

Thousands of Australians are expected to take to the streets in every capital city to protest his visit, citing his culpability in Israel’s bombardment and starvation of Palestinians in Gaza.

Among those planning to attend in Sydney is NSW Labor backbencher Sarah Kaine, who said she was concerned about Herzog’s visit.

“Given that he has signed bombs that have targeted civilians and have killed Gaza’s children, I don’t think it’s appropriate,” she told AAP on Thursday.

“I understand that the Jewish community is grieving but there is a large population of Palestinians in Australia who are also grieving and this is traumatic for this man to be in our country.”

NSW Labor MLC Sarah Kaine (file image)
Sarah Kaine believes Isaac Herzog’s visit isn’t appropriate despite grief in the Jewish community. (Bianca De Marchi/AAP PHOTOS)

Herzog has previously said Palestinians bore collective blame for Hamas’ attack on Israel on October 7, 2023, before later clarifying his remarks.

A United Nations Human Rights Council commission of inquiry in September found the statement might reasonably have been interpreted as inciting genocide.

A genocide case against Israel has been brought to the International Court of Justice, and the International Criminal Court has issued arrest warrants for Israeli Prime Minister Benjamin Netanyahu for his alleged responsibility for war crimes of starvation as a method of warfare.