Prime Minister Benjamin Netanyahu warned late Thursday that incitement is a dangerous phenomenon that endangers Israeli democracy and that social media has become a “hotspot” for extremists.

In a Facebook statement, the prime minister also “strongly condemned” the recent post by Hagai Amir — the brother of Yitzhak Rabin assassin Yigal Amir — wishing death on President Reuven Rivlin.

“Incitement is a dangerous phenomenon that must be eradicated from Israeli society. It comes from the Right and the Left… It endangers our democracy,” Netanyahu wrote.

Social media has its merits, but it can be a “hotspot for extremists who turn freedom of speech into freedom to incite,” he warned.

Hagai Amir attends a court session in Tel Aviv over a Faebook post that police say incited against President Reuven Rivlin, on Wednesday, October 28, 2015 (Flash90)

Hagai Amir attends a court session in Tel Aviv over a Facebook post that police say incited against President Reuven Rivlin, on Wednesday, October 28, 2015. (Flash90)

“I strongly condemn the post Hagai Amir posted against the president. I am disturbed by the incitement directed at other public officials and the inciting statements posted against me. Not surprisingly, these did not merit much media coverage,” said the Israeli leader, in reference to an incident earlier this month in which a Ynet editor uploaded a photoshopped image of Netanyahu in a Waffen SS uniform.

Netanyahu criticized the Israeli media for failing to appropriately condemn the Facebook post published by Gilad Halpern, the editor of Ynet’s English edition.

“It’s interesting that the media in Israel, which always appears to be ‘shocked’ by incitement against Israeli leaders, chose to downplay the incitement against me in this post,” he wrote at the time.

“Incitement is incitement, whether it emanates from the Right or from the Left,” Netanyahu said Thursday.

Earlier this week, Hagai Amir, who served 16 years in prison for helping to plan and carry out the murder of former prime minister Rabin, was arrested then released to house arrest for his Facebook post wishing Rivlin would “depart from this world.”

The post came in response to a statement from Rivlin — on the 20th anniversary of the assassination — that he would never pardon Hagai Amir’s younger brother, Yigal.

“He does not determine whether my brother goes free or not, only God does, just as He determined that Rabin would die even though Rivlin and his friends didn’t exactly agree. He determined that Rivlin would be president, and the time will come when he will determine that Rivlin, along with the Zionist state, must depart from this world, just like Sodom did, for the crimes that it has committed against its people within the framework of the law,” Hagai Amir wrote on Facebook.

A Tel Aviv magistrate’s court judge sent Amir to house arrest until November 8, saying he posed a “public threat.” Amir posted a NIS 20,000 ($5,100) bond.

“Given the state’s painful experience in the past regarding threats against elected officials, there is a public threat to which there is no alternative to detention,” Judge Yaron Gat wrote in his decision, according to the Ynet news site.

Gat also said he took into account Amir’s past.

During the hearing, Amir argued that his arrest was politically motivated.

“This is a political arrest. I’m not sorry for a thing,” he said, according to the Walla news outlet.

His attorney said the post was not a threat against Rivlin’s life.

Amir was convicted in 1996 of conspiracy to commit murder and possession of a firearm, after his brother Yigal Amir’s assassination of Rabin after a peace rally in Tel Aviv on November 4, 1995.

He was released from prison in 2012, after serving a 16-year sentence for his role in the assassination. Both Amir brothers have repeatedly said they do not regret their actions.

Police said the investigation into Amir’s Facebook post was ongoing.