BERKELEY, Calif. (KTVU) -- A talk at the University of California at Berkeley by Milo Yiannopoulos , a polarizing Breitbart News editor, was canceled Wednesday out of safety concerns after protesters hurled smoke bombs, broke windows and started a bonfire.

The decision was made two hours before the Wednesday night event because a crowd of more than 1,500 had gathered outside the venue, the university said in a statement.

"Of paramount importance this evening was the campus's commitment to ensure the safety and security of those attending the event, the speaker, those who came to engage in lawful protest, as well as members of the public and the Berkeley campus community," it said.

The 32-year-old right-wing provocateur is a vocal supporter of President Donald Trump and a self-proclaimed internet troll whose comments have been criticized as racist, misogynist, anti-Muslim and white supremacist. He was banned from Twitter after leading a harassment campaign against "Ghostbusters" actress Leslie Jones.

Hundreds of peaceful demonstrators carrying signs that read "Hate Speech Is Not Free Speech" had been protesting for hours before the event. A smaller group of protesters dressed in black and in hooded sweatshirts showed up as night fell and used metal barricades to break windows, threw smoke bombs and flares and set a large bonfire outside the building.

Yiannopoulos' visit to Berkeley was sponsored by the campus Republican club. The university has stressed it did not invite him and does not endorse his ideas but is committed to free speech and rejected calls to cancel the event.

"The event has been cancelled," Yiannopoulos posted on his Facebook page. "I'll let you know more when the facts become clear. One thing we do know for sure: the Left is absolutely terrified of free speech and will do literally anything to shut it down."

Earlier Wednesday, the university sent a notice to all students that warned of crowds near the student union, where the 500-seat, sold-out event was scheduled.

"We anticipate there will be major protest/ demonstration activity leading up to and surrounding this event," the letter from school officials said. It did not discourage protests but advised those who didn't wish to participate to avoid the area.

Pieter Sittler, a spokesman for the Berkeley College Republicans, said the club doesn't support everything Yiannopoulos says but "he gives a voice to repressed conservative thought on American college campuses." He uses "levity and humor" that should not be taken literally, Sittler said.

Yiannopoulos' talks have sparked protests, shouting matches and occasional violence at stops around the country. A man was shot and wounded at protests outside his Jan. 21 talk at the University of Washington.

Rowdy protests at UC Davis Jan. 13 prompted campus Republicans to cancel his appearance at the last minute. His final stop was supposed to be UCLA on Thursday but the invitation was rescinded, making Berkeley his grand finale.

KTVU staff reports, the Associated Press and Bay City News contributed to this report.