BERKELEY, Calif. – Violence during a protest Wednesday night prompted University of California at Berkeley officials to cancel a talk by a polarizing editor of Breitbart News out of safety concerns.

The decision to scrap the event was made two hours before the scheduled appearance of Milo Yiannopoulos.

A crowd of more than 1,500 had gathered outside the talk’s venue.

Get Breaking News Delivered to Your Inbox

In a statement, the school blamed outsiders. But Yiannopoulos blamed left-wingers. And President Trump had his say, on Twitter.

“Amid an apparently organized violent attack and destruction of property at the Martin Luther King Student Union, the University of California Police Department determined that it was necessary to evacuate Milo Yiannopoulos from the campus and to cancel tonight’s scheduled 8 p.m. performance,” the statement read. “The violence was instigated by a group of about 150 masked agitators who came onto campus and interrupted an otherwise non-violent protest.”

Officials said the smaller group was dressed in black and in hooded sweatshirts and 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. Bricks were also used.

CBS San Francisco reports at least four banks and a nearby Starbucks were vandalized.

“I do not believe our students were involved in the vandalism and the violent behavior that occurred. This was a group of agitators who were masked up, throwing rocks, commercial grade fireworks and Molotov cocktails at officers,” UC Berkeley Police Chief Margo Bennet told reporters. “Those were not our students. That’s not our students’ behavior.”

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

Campus police reported one arrest. The charges weren’t immediately announced.

There were no reports of serious injuries, Bennet said.

Late Wednesday night, campus police issued an all clear to an earlier shelter in place and lockdown:

All clear for campus lockdown issued at 10:55PM. Routine campus business and classes will be held tomorrow. — UC Police, Berkeley (@UCPD_Cal) February 2, 2017

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

Yiannopoulos posted on his Facebook page that he was safe – and blamed the demonstrators. “I have been evacuated from the UC Berkeley campus after violent left-wing protestors tore down barricades, lit fires, threw rocks and Roman candles at the windows and breached the ground floor of the building,” the post read. “My team and I are safe. But the event has been cancelled.

“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.”

President Trump tweeted his take:

If U.C. Berkeley does not allow free speech and practices violence on innocent people with a different point of view - NO FEDERAL FUNDS? — Donald J. Trump (@realDonaldTrump) February 2, 2017

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.

Campus spokesperson Dan Mogulof told reporters, “We condemn without reservation the violence that was on display, and the actions of a few that tainted the desires of the many to engage in legal and lawful protest, and who also interfered with the ability of an individual and those in the Berkeley College Republicans and those in the audience to exercise their First Amendment rights.

“This is not a proud night for this campus, the home of the free speech movement.”

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.