BERKELEY — The morning after violent protests outside an event featuring far-right Breitbart editor Milo Yiannopoulos forced UC Berkeley to cancel the event, President Donald Trump took to Twitter and threatened to yank federal funds from the prestigious research university:

If U.C. Berkeley does not allow free speech and practices violence on innocent people with a different point of view – NO FEDERAL FUNDS? — Donald J. Trump (@realDonaldTrump) February 2, 2017

The loss of federal funds would have devastating effects for Cal’s research enterprise and for its students. Nearly one-third of UC Berkeley’s 27,000 undergraduates count on federal Pell Grants to pay for college, according to College Scorecard data from the U.S. Department of Education, and research labs across the 10-campus system receive more than $1 billion in federal grants to do their work. Nearly $200 million in federal student aid and $400 million in basic research grants flow to the UC Berkeley campus alone each year, said campus spokesman Dan Mogulof.

Related Articles Black at UC Berkeley: Professor Tyrone Hayes on discrimination in academia

What is Proposition 16? Affirmative action back on the ballot, in a more diverse California

University of California must stop all use of SAT and ACT in admissions, judge orders

Why no break on UC tuition despite the move to remote classes? COVID-19 costs are astronomical

University of California campuses to phase out single-use plastics, including cups and water bottles Such a move would be unprecedented, experts say — perhaps for a simple reason: The president, and even Congress, do not appear to have the legal authority to carry it out.

“There’s nothing I’m aware of in federal law that would allow the federal government to strip financial aid funds or research funds from a university because the government claims they aren’t respecting First Amendment rights,” said Don Heller, the University of San Francisco provost and an expert in federal financial aid.

“But maybe the president’s plan is to change the law and get Congress to change the law,” Heller said. “Maybe that’s his intent.”

Bob Shireman, a former undersecretary of education during the Obama administration, said that if Trump and Congress wanted to punish UC Berkeley by pulling its federal funding, “I’m not sure what authority they would use.”

The federal government can cut off Pell Grants and federal student loans from a school suspected of engaging in fraud or providing a substandard education — as happened with the for-profit college giant ITT Tech last year before the company “saw the writing on the wall” and closed its doors, said Terry Hartle, senior vice president for government and public affairs for the American Council on Education.

Similarly, Hartle said, federal agencies that award competitive research grants, such as the National Science Foundation, can cut off federal grant funding to an institution found to have engaged in research fraud or scientific misconduct. But, he said, “There is no law on the books that would allow the federal government to shut off funds to a university for a suspected First Amendment problem.”

Congress could give Trump that authority, Hartle said, but such a law would be difficult to draft. “You’d have to deal with a Holocaust denier at a rabbinical school,” he said.

UC Berkeley evolutionary biologist Michael Eisen, who last week announced he was running for Dianne Feinstein’s U.S. Senate seat in 2018, had a skeptical reaction to the tweet.

“Honestly,” he wrote in an email Thursday, “I’m trying not to take every half-cocked tweet from Trump seriously.”

Others are more concerned. The president’s tweet presented “a terrible threat,” said Dr. Henry Bourne, a retired biomedical researcher and professor emeritus at UC San Francisco. “It is very scary to scientists,” he said, “and makes them feel they have a president who thinks science is not a worthwhile endeavor.”

Even if there aren’t legal grounds to turn off federal funding, what about behind-the-scenes pressure? Trump could certainly lean on agencies to withhold future grants from UC Berkeley researchers, Heller said, but it would be a challenge, given the lengthy, peer-reviewed process used to determine which projects are funded.

“If he did try to do that,” Heller said, “I think there would be very strong condemnation not just from university but by representatives on both sides of the aisle for trying to interfere with the scientific process.”

Trump wouldn’t be the first to try it.

Ed David, a science adviser to President Richard Nixon in the early 1970s, said during a 2005 lecture at Colorado University that Nixon once summoned him to the White House and demanded he cut off all federal funding to MIT because Nixon disagreed with the college president’s politics.

Flummoxed because the MIT president was a friend and thesis adviser — and “because you know enough about the government that that’s completely impossible, even if you wanted to do it” — David returned to his office and wondered what to do, according to a published transcript in which he was interviewed by Colorado University Professor Roger Pielke Jr.

.A colleague called David up and gave him advice: “Don’t do anything and it will all go away,” David told Pielke. “And I didn’t do anything and it all went away.”