BERKELEY, Calif. (AP) - Protesters hurled smoke bombs, broke windows and sparked a massive bonfire Wednesday night, prompting University of California at Berkeley officials to cancel a talk by a polarizing editor of Breitbart News out of safety concerns.

The decision was made two hours before the appearance of Milo Yiannopoulos (yuh-NAH'-poh-lihs) because a crowd of more than 1,500 had gathered outside the venue, the university said in a statement.

But officials said it was a smaller group of protesters dressed in black and in hooded sweatshirts that showed up as night fell to break windows with metal barricades, throw smoke bombs and flares and start a large bonfire outside the building with a diesel generator.

"This was a group of agitators who were masked up, throwing rocks, commercial grade fireworks and Molotov cocktails at officers," said UC Berkeley Police Chief Margo Bennet.

Bennet said police determined at that point they couldn't guarantee security, canceled the event and evacuated Yiannopoulos from the building.

There were no immediate reports of arrests or serious injuries, she said.

Prior to the burst of violence, hundreds of peaceful demonstrators carrying signs that read "Hate Speech Is Not Free Speech" had been protesting for hours.

As the evening wore on, crowds of protesters cleared away from outside the building. By 8 p.m. the crowd had thinned and at least 100 protesters that remained danced to a brass band playing music and marched off campus and into a main avenue.

Yiannopoulos, a 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.

His 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."

The Berkeley College Republicans said its "constitutional right to free speech was silenced by criminals and thugs."

"Their success is a defeat for civilized society and the free exchange of ideas on college campuses across America," it said in a statement.

The university, which had requested assistance from police in nine UC campuses, sent a notice to all students earlier Wednesday that warned of crowds near the student union, where the 500-seat, sold-out event was scheduled.

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.