“We should refuse to allow hateful speakers on campus,” a campus faculty member said.

The statement was met with resounding applause. I mentally prepared for the response to what I was going to say next.

It was September, and I was at a forum at which several professors, including me, discussed free speech issues before a large audience of students at the University of California Berkeley. Several faculty and students had already implored Chancellor Carol Christ to revoke the invitations of conservative provocateurs Milo Yiannopoulos and Ann Coulter to speak on campus, and their declarations were met with enthusiasm.

Read Robert Post’s argument that it makes little sense to apply the First Amendment to colleges here.

Finally, I spoke up. “Be clear that if Chancellor Christ were to exclude speakers based on their viewpoint, she would get sued and lose,” I said. “The speakers would get an injunction and be allowed to speak. They would recover attorneys’ fees and maybe money damages. They would be portrayed as victims. And since they would get to speak anyway, nothing would be gained.”

No one applauded.

I have been dean of Berkeley’s law school for several months. But before I arrived at campus, the university, home of the free speech movement of the 1960s, had become a battleground for a new kind of campus speech debate.

In late September, elaborate security precautions were taken when conservative commentator Ben Shapiro spoke at Berkeley; $600,000 had to be spent so he could deliver his remarks without disruption. When conservative student groups attempted to host a “Free Speech Week,” and invited conservative speakers like Coulter and Steve Bannon, the campus steeled itself to spend in excess of $1 million to allow them to speak while ensuring safety on the campus. (In the end, “Free Speech Week” was canceled by the student group that had organized it.)

I have been teaching First Amendment law to law students and undergraduates for more than 37 years. I have also litigated free speech cases, including at the Supreme Court. I believe that Chancellor Christ and the campus have done a superb job of adhering to the First Amendment, protecting free speech while ensuring the safety of students, staff, and faculty. But it’s also become clear to me that current college students are often ambivalent, or even hostile, to the idea of free speech on campus.

Students today are driven by a desire to protect their classmates from hate speech

Disputes over free speech on campus have long occurred, but today is different. Usually in the past, it was students who wanted to speak out and campus administrators who tried to stop demonstrations. Now it often is about outside speakers and outside disruptors, like the radical leftist protest group antifa. The campus is just the place for their battle.

At Berkeley and elsewhere, it is now often students and faculty calling for preventing the speakers while campus officials are steadfastly protecting freedom of expression.

In my seminars the past two years (before Berkeley, I was at UC Irvine’s law school), I was surprised by how much the students wanted campuses to stop offensive speech — and the degree to which they trusted campus officials to have the power to do so. A 2015 survey by the Pew Research Institute said that four in 10 college students believe the government should be able to prevent people from publicly making statements that are offensive to minority groups.

While teaching our class on free speech on campus at UC Irvine, Chancellor Howard Gillman and I realized that the students’ desire to restrict hurtful speech came from laudable instincts. This is the first generation of college students to be taught from a young age that bullying is wrong; they have internalized this message. Many spoke powerfully of instances in which they or their friends had suffered from hurtful speech. They want to make campuses inclusive for all, and they know that hate speech causes great harm, especially among those who have been traditionally underrepresented in higher education.

But I worry, too, that students do not realize the degree to which free speech has been essential for the advancement of rights and equality. There would not have been a 19th Amendment, which gave women the right to vote, without the women’s suffrage movement and its widespread demonstrations. The civil rights protests of the 1960s — lunch counter sit-ins, the march on Selma, demonstrations on campuses — were essential to bringing about the end of segregation.

Those events, though, are ancient history for my students. I worry that they equate freedom of speech more with the vitriol of the anonymous messaging app Yik Yak than the anti-Vietnam War protests I participated in when I was in college. I was surprised by how little our students knew about the history of free speech, including the outbreak of McCarthyism, when faculty and students suffered greatly from the lack of legal protection for expression and academic freedom.

Although all of this makes the context different today, the law of the First Amendment and the principles of academic freedom are clear and long established. The Supreme Court repeatedly has said that the First Amendment means public institutions cannot punish speech, or exclude speakers, on the grounds that it is hateful or deeply offensive. This includes public colleges and universities.

Hate speech is protected by the First Amendment

Every effort by the government to regulate hate speech has been declared unconstitutional. Over 25 years ago, more than 350 colleges and universities adopted hate speech codes. But every court to consider such a hate speech code declared it to be unconstitutional. The codes inevitably were far too vague in terms of what speech was permitted and what was prohibited. Of course, free speech is not absolute and can be punished when it incites illegal activity, constitutes a “true threat” that causes a person to fear imminent harm to his or her physical safety, or rises to the level of prohibited harassment.

This does not mean that campuses are powerless in the face of disruptive or hateful speech. Even though there is a First Amendment right to speak, that does not mean that protesters have the right to demonstrate in the middle of a freeway at rush hour. A campus surely could prohibit a large demonstration in a classroom building while classes are in session. Campuses can regulate when and where speech takes place in order to prevent disruption of school activities. Controversial speakers can be placed in auditoriums where it is easier to assure safety and prevent disruptions. Demonstrations can be placed in areas away from where classes are in session.

Although the First Amendment applies only to the government, including public universities, private universities should follow these same principles. They are essential to academic freedom, which is at the very core of a university’s mission.

There might be a point at which it is impossible to simultaneously protect public safety and allow controversial speech to occur. Then campus officials have no choice but to prevent the speech, given that they must provide for the safety of students, staff, and faculty. But canceling a speaker should truly be a last resort and never based on the viewpoint expressed.

At what point should a campus cancel a speaker because it cannot afford to ensure the safety of students, staff, and faculty? Chancellor Christ has estimated that already this semester, the campus has spent more than $2 million to protect free speech. I believe Berkeley campus officials made the right choice in protecting these speakers from harm, but I also know that such expenditures are not sustainable.

Although speakers have a right to express hateful messages on campus, that does not mean that campus officials should silently tolerate such speech. It is important that campus officials denounce hate when it occurs and explain why it is inconsistent with the type of community we desire.

Education is enhanced when there is more speech, not when speech is regulated by campus officials

The law is clear that a public university may not exclude a speaker based on his or her views, nor may students or faculty be punished for the views they express. In a separate piece for Vox, professor Robert Post challenges this by suggesting that usual free speech principles should not apply on campus. He argues that campuses must of course engage in content-based judgments in evaluating a faculty member’s scholarship or a student’s work. From this, he concludes that universities are justified in excluding outside speakers that do not serve the educational mission of the campus.

Post’s premise is undoubtedly correct: Universities must evaluate the content of faculty and student work. But it does not follow that outside of this realm, free speech principles do not apply on campus. It is a logical fallacy to say that because basic free speech principles sometimes do not apply on campus, they must never apply.

First, it is important to distinguish what the law is from what Post thinks the law should be. Under current First Amendment law, a public university clearly would be acting unconstitutionally if it excluded a speaker from campus based on his or her viewpoint. When Auburn University attempted to prevent white supremacist Richard Spencer from speaking, a federal court ruled against the university.

Second, Post ignores the distinction between the university’s ability to regulate speech in professional settings (such as in grading students’ papers or in evaluating teaching and scholarship) and its ability to regulate speech in other contexts. The former does not justify a university’s ability to restrict campus speakers based on viewpoint or to punish student or faculty speech in a nonprofessional setting.

Professor Post also argues that a primary purpose of a university is to educate students — so a campus would be justified in excluding speakers that it perceives as interfering with this mission. But the law says quite the contrary. It does not allow a public university to exclude a speaker by claiming that the viewpoint expressed would be so offensive to students that it would interfere with their education. Also, this would seem to give unlimited discretion to campus officials to exclude or punish any speaker that they deemed to be inconsistent with students’ education. The assumption of freedom of speech, and of academic freedom, is that education is enhanced when there is more speech, not when government officials have the power to censor and punish speech they don’t like.

Having seen the enormous amount of time and money invested by the Berkeley campus to deal with the appearances of Ben Shapiro and Milo Yiannopoulos, I cannot help but wish this had happened someplace else. But I know that Berkeley, especially because of its history with the free speech movement of the 1960s, is a unique place for expression. This is why it is so important that the campus did all it could to ensure freedom of speech. It is also why this campus has the chance to be a model for other schools in upholding the principle that all ideas and views can be expressed at colleges and universities.

Erwin Chemerinsky is dean and Jesse H. Choper distinguished professor of law at the University of California Berkeley School of Law. He is the co-author, with Howard Gillman, of Free Speech on Campus (Yale University Press, 2017).

The Big Idea is Vox’s home for smart discussion of the most important issues and ideas in politics, science, and culture — typically by outside contributors. If you have an idea for a piece, pitch us at thebigidea@vox.com.