After a planned speech in February by the right-wing writer Milo Yiannopoulos attracted demonstrators who started fires and shattered windows, the University of California, Berkeley realized it had a major hole in its event planning.

“We did not have enough police officers,” said Dan Mogulof, assistant vice chancellor for public affairs at Berkeley.

So beginning this semester, student groups hosting large events are required to inform the college at least eight weeks in advance, so it has time to prepare a security plan. For the most controversial speakers, hundreds of police officers will be drawn from across the University of California system and also, under mutual aid agreements, from municipal police departments across the region. Security checkpoints and buffer zones will be erected around venues.

Berkeley is ready to spend as much as $500,000 to protect a single lecture, Mr. Mogulof said, and will do so regardless of the speaker’s ideology.