The University of California at Berkeley's cancellation of a far-right commentator's talk amid violent protests prompted a tweeted warning from President Donald Trump to allow free speech or perhaps risk losing federal funding.

But the financial aid that flows to students and the grants awarded researchers don't come with a free speech condition, experts said. And even if they did, the experts said it would be hard to find fault with Berkeley.

Trump's Thursday morning tweet — "If U.C. Berkeley does not allow free speech and practices violence on innocent people with a different point of view — NO FEDERAL FUNDS?" — followed a chaotic night on the California campus. Protesters dressed in black and in hooded sweatshirts broke windows, threw smoke bombs and set fires in protest of a scheduled talk by Milo Yiannopoulos, a polarizing editor of Breitbart News.

University officials, citing safety concerns, called off the event, evacuated Yiannopoulos and locked down buildings on campus for several hours.

"There's nothing under current law that would enable the federal government to shut off funding based on allegations of free speech violation," Terry Hartle, senior vice president at the American Council on Education in Washington, said by phone.

Federal support for higher education has increased in recent years, even surpassing state support, which has fallen, said Phil Oliff, a research manager at Pew Charitable Trusts. But virtually all federal funds follow individuals to campus in the form of student financial aid, veterans benefits for students, or funding won by researchers. That differs from state funding, which generally supports public universities.

Maimie Voight, policy research vice president at the Institute for Higher Education Policy, said the federal government can shut off funding if it decides a college's academics aren't up to par or if it's involved in fraud or misconduct. "But there's no authority to pull it based on free speech conditions," she said.

Hartle said that would be an "extraordinarily complicated" issue to tackle with legislation.

In any case, what happened on Wednesday was different: "Berkeley didn't prevent the speaker," he said, "the violence did."