Ms. Walden said she and the others sneaked into the building with sleeping bags and food on Thursday night and slept in a classroom, keeping quiet until the police arrived around 7 a.m. Friday. Three students were arrested, she said.

Image Hundreds of students protesting outside on Friday. Some of them chanted, “Fee hike! We strike!” Credit... Paul Sakuma/Associated Press

At 5 p.m., the police entered the building. Forty people were arrested without incident.

Claire Holmes, a Berkeley spokeswoman, said that about 500 people participated in protests across campus on Friday, becoming more confrontational as the hours went by.

“One of our officers has gone to the hospital with injuries,” she said, “so we are in the process of getting some help from the Alameda Sheriff’s Office and the Berkeley Police Department.”

On Thursday, when the Regents voted to raise undergraduate fees to $10,302 next fall, from $7,788 this year, protesters dumped a five-foot mound of trash bags outside California Hall, Berkeley’s administration building.

“They made their symbolic point, and then they cleaned it up, because they knew it would make more work for the workers they were trying to support,” Ms. Holmes said.