Updated

President Trump on Thursday signed an executive order to promote free speech on college campuses by threatening colleges with the loss of federal research funding if they do not protect those rights.

"We’re here to take historic action to defend American students and American values," Trump said, surrounded by conservative student activists at the signing ceremony. "They’ve been under siege."

"Under the guise of speech codes, safe spaces and trigger warnings, these universities have tried to restrict free thought, impose total conformity and shut down the voices of great young Americans like those here today," he said.

FLASHBACK: CONSERVATIVE ACTIVIST ATTACKED ON UC-BERKELEY CAMPUS DURING RECRUITMENT DRIVE

A senior administration official said the order directs 12 grant-making agencies to use their authority in coordination with the White House Office of Management and Budget (OMB) to ensure institutions that receive federal research or education grants promote free speech and free inquiry. White House officials have said it will apply to more than $35 billion in grants.

Public universities seeking funding would have to certify they comply with the First Amendment, which already applies to them. Private universities, which have more flexibility in limiting speech, would need to commit to their own institutional rules.

"Even as universities have received billions and billions of dollars from taxpayers, many have become increasingly hostile to free speech and the First Amendment," Trump said.

TRUMP, ON CPAC STAGE WITH BERKELEY ASSAULT VICTIM, PROMISES EXECUTIVE ORDER ON CAMPUS FREE SPEECH

Trump had announced that such an order was forthcoming at the Conservative Political Action Conference last month, where he said the directive would require colleges and universities to support free speech in exchange for federal research dollars.

He brought on stage Hayden Williams, a conservative activist who was attacked while working a recruitment table on campus at the University of California-Berkeley. The video quickly went viral, with conservatives citing it as further evidence of the stifling and sometimes-violent atmosphere that conservatives face on campus.

OPINION: TRUMP ORDER PROTECTING CAMPUS FREE SPEECH IS RIGHT RESPONSE TO BERKELEY ASSAULT

“He took a punch for all of us,” Trump said of Williams. “And we could never allow that to happen. And here is, in closing with Hayden, here’s the good news. He’s going to be a wealthy young man.”

“If they want our dollars, and we give it to them by the billions, they’ve got to allow people like Hayden and many other great young people and old people to speak,” Trump said. “Free speech. If they don’t, it will be costly. That will be signed soon.”

Talk show host Dennis Prager, who appears in an upcoming documentary called "No Safe Spaces," said Thursday: "It's tragic that in the one country that was founded on liberty--the country that enshrined freedom of speech in its foundational document--this executive order has become necessary. But, thanks to the left, it has. If President Trump can put a stop to the intolerance of non-leftist viewpoints on college campuses and help steer the country in the right direction, there just might be hope."

CLICK HERE TO GET THE FOX NEWS APP

Conservative commentators such as Ann Coulter and Ben Shapiro have faced hostile atmospheres when trying to speak at universities -- particularly Berkeley, where Coulter was forced to pull out of speaking and Shapiro faced protests that required police in full riot gear and intense security measures.

White House officials declined to provide specific examples about how universities could lose funding and said implementation details will be finalized in coming months.

Fox News’ Kellianne Jones, Robert Gearty and The Associated Press contributed to this report.