At least nine people were arrested Thursday night related to protests at the University of California, Berkeley, over an appearance by former Breitbart editor Ben Shapiro.

UC Berkeley spokesman Dan Mogulof said the security measures could cost $600,000. Mogulof called the speech "a successful event" and said the university was committed to hosting speakers like Shapiro in the future.

The evening did have its share of hiccups. Police said three arrests were weapons-related. Among them:

-- Hannah Benjamin, 20, was arrested for battery on a police officer and carrying a banned weapon.

-- Sarah Roark, 44, was taken into custody for carrying a banned weapon.

The arrests were announced on the police Twitter account.

The demonstrators, however, were largely peaceful. Some chanted against fascism, white supremacists and President Donald Trump. Others were holed up inside a student building, waving signs protesting the university's decision to allow Shapiro on campus.

Inside the hall, Shapiro addressed a friendly crowd. He encouraged people to hold civil discussions with people who have different opinions, saying that's what America is all about. He condemned white supremacists as "a very small select group of absolutely terrible people who believe absolutely terrible things."

The campus and surrounding Berkeley streets were under tight security after a series of previous events turned violent.

City and campus officials anticipated protests against Shapiro, and prepared for possible violence with a variety of new strategies and tightened security. It was not immediately clear whether the people arrested Thursday were protesters.

The Berkeley College Republicans invited right-wing provocateur Milo Yiannopoulos to speak last February, but the event was abruptly canceled when masked left-wing anarchists rioted outside the event to shut it down.

A planned speech by author Ann Coulter was canceled in April.

Police with riot gear surrounded the plaza outside Zellerbach Hall, where Shapiro spoke.

For the first time in two decades, officers were armed with pepper spray after the city council modified a 1997 ban at an emergency meeting this week.

"We have seen extremists on the left and right in our city," said Berkeley Mayor Jesse Arreguin, a Democrat who backed the police request to use pepper spray. "We need to make sure violence is not allowed."

The Associated Press contributed to this report.