People protest Breitbart writer Milo Yiannopoulos’s scheduled speech Tuesday at the University of California at Berkeley. (Elijah Nouvelage/Getty Images)

President Trump picked a fight with California’s flagship public university Thursday, threatening to pull funding from a school that has long symbolized the fight for free speech, on the day after violent protests shut down a controversial speaker.

“If U.C. Berkeley does not allow free speech and practices violence on innocent people with a different point of view — NO FEDERAL FUNDS?” Trump tweeted.

University of California police canceled an event by Milo Yiannopoulos and put the Berkeley campus on lockdown Wednesday after about 150 people wearing masks swarmed into a group of about 1,500 students who had been peacefully protesting the speech, and began setting fires, smashing windows, and throwing rocks and firecrackers at police.

The fight was emblematic of the tensions over academic freedom and cultural issues that have been simmering on campuses across the country — and it exploded on a campus where students fought for free speech decades before.

Yiannopoulos, a provocative and polarizing figure, writes for the Breitbart website, which until recently was led by Stephen K. Bannon, Trump’s chief strategist.

Yiannopoulos has a large following as a self-proclaimed “free-speech fundamentalist” crusading against political correctness. His detractors call him a hatemonger. He was banned from Twitter last summer after sending tweets targeting actress Leslie Jones, who is black.

His campus speeches usually spark intense protests. In January, a man was shot and seriously wounded as fights broke out during one of those events at the University of Washington.

When the events are canceled, some call it censorship. Others counter that universities aren’t required to pay security and other expenses for speakers invited by student groups.

After his Berkeley event was canceled, the 32-year-old Yiannopoulos posted on Facebook: “One thing we do know for sure: the Left is absolutely terrified of free speech and will do literally anything to shut it down.”

When Trump raised the possibility of cutting funds, California Lt. Gov. Gavin Newsom (D) tweeted in response: “As a UC Regent I’m appalled at your willingness to deprive over 38,000 students access to an education because of the actions of a few.”

Student loans and grants make up the vast majority of federal funding to colleges and universities, along with research grants from agencies such as the National Institutes of Health. Whether or how Trump could target Berkeley for funding cuts is unclear.

Free speech is an exceptionally volatile issue now, with debate over code words, safe spaces, implicit bias and microaggressions on campuses across the country.

That debate has particular resonance at Berkeley, where the Free Speech Movement began with student protests in 1964.

Some members of that original movement wrote an op-ed about Yiannopoulos last month in the student newspaper, the Daily Californian. They described him as a bigot who baits students “in the hopes of sparking a speaking ban or physical altercation so he can pose as a free speech martyr. His campus events are one long publicity stunt designed to present himself as a kind of hip, far right, youth folk hero — sort of Hitler Youth with cool sunglasses.” They argued that banning him would just play into his hands.

On Wednesday night, the Daily Californian reported that protesters were chanting, “No Milo, no Trump, no fascist USA,” setting off fireworks, throwing rocks and bricks, and pounding on windows, and that university police tried to disperse the crowd by firing rubber bullets and tear gas. UC police canceled the speech that night.

Berkeley’s administration said it went to “extraordinary lengths” to plan for the event, working with the Berkeley College Republicans and adding dozens of additional police officers.

Security officials said that 150 people disrupted a peaceful demonstration, setting fires, throwing molotov cocktails and rocks, and attacking some people in the crowd.

Such “black bloc” masked protesters, difficult for police to recognize at first sight, have frequently been seen elsewhere, including in Washington on the day of Trump’s inauguration.

Campus officials said in a statement that “they regret that the threats and unlawful actions of a few have interfered with the exercise of First Amendment rights on a campus that is proud of its history and legacy as the home of the Free Speech Movement.”

Some at Berkeley had worried that Yiannopoulos would single out individual students as examples of illegal immigration, because a Breitbart story Tuesday said he would kick-start a campaign at Berkeley to take on “sanctuary campuses” and call to withdraw federal grants to such schools.

In advance of the event, more than 100 faculty members signed letters urging Berkeley Chancellor Nicholas Dirks to cancel the speech. They argued that Yiannopoulos’s views could change from protected speech to “incitement, harassment and defamation once they publicly target individuals in his audience or on campus.”

Nils Gilman, an associate chancellor, responded that “our Constitution does not permit the university to engage in prior restraint of a speaker out of fear that he might engage in even hateful verbal attacks.”

The Berkeley College Republicans, who sponsored the sold-out event, wrote on social media after the protests, “The Free Speech Movement is dead.

“Today, the Berkeley College Republicans’ constitutional right to free speech was silenced by criminals and thugs seeking to cancel Milo Yiannopoulos’ tour. . . . It is tragic that the birthplace of the Free Speech Movement is also its final resting place.”

Get updates on your area delivered via e-mail