Los Angeles (AFP) – President Donald Trump threatened Thursday to withdraw federal funds from UC Berkeley after violent overnight protests against a planned appearance by a controversial editor of conservative news website Breitbart.

Hundreds of students and other protesters chanting “shut him down” smashed windows at the University of California campus, set wooden pallets on fire and threw fireworks and rocks as police in full riot gear responded with tear gas.

The university was placed on lockdown as the sold-out appearance by Milo Yiannopoulos, a conservative firebrand, was canceled Wednesday evening.

“If U.C. Berkeley does not allow free speech and practices violence on innocent people with a different point of view – NO FEDERAL FUNDS?” Trump wrote on Twitter Thursday.

Trump’s top political adviser Stephen Bannon is the former chairman of Breitbart News.

Yiannopoulos, who is the Breitbart technology editor, is known for his provocative social media posts and was banned from Twitter in July for fueling abuse directed at “Ghostbusters” actress Leslie Jones.

The British journalist is a vocal supporter of Donald Trump — nicknaming the US president “Daddy” during his election campaign — and has become one of the faces of America’s “alt-right” movement.

Similar protests at the University of California at Davis last month also forced the cancellation of speeches by Yiannopoulos and former pharmaceutical executive Martin Shkreli.

The events at Davis and Berkeley were organized by conservative student groups. A similar invitation to speak at UCLA was rescinded and Berkeley was to be the last stop of his tour.

Officials at the three University of California campuses stressed that they did not invite Yiannopoulos or endorse his ideas but were committed to free speech.

More than 100 UC Berkeley faculty members had signed two letters sent last month to the school’s chancellor, urging him to cancel the event.

“Although we object strenuously to Yiannopoulos’s views — he advocates white supremacy, transphobia and misogyny — it is rather his harmful conduct to which we call attention in asking for the cancellation of this event,” read one of the letters.

They cited as one example an incident in December at the University of Milwaukee where Yiannopoulos — a gay crusader against “political correctness” — openly mocked a transgender student, displaying her name and photo on screen.