A US judge ordered the Trump administration on Wednesday to overturn deep funding cuts to Harvard University that froze more than $2 billion over allegations of antisemitism and bias at the Ivy League institution.

The administration, which vowed to appeal, insisted its move was legally justified over Harvard's alleged failure to protect Jewish and Israeli students amid campus protests against Israel's war in Gaza.

Harvard denied those claims, saying Trump was instead focused on controlling the prestigious school's hiring, admissions and curriculum.

The cuts to Harvard's funding stream forced it to implement a hiring freeze while pausing ambitious research programs, particularly in the public health and medical spheres -- pauses experts warned put American lives at risk.

The ruling could shape talks on a settlement reportedly underway between Harvard and the White House under which the university would pay a sum acknowledging Trump's claims, with federal funding restored in return.

Other universities have struck similar deals with the administration.

"The Court vacates and sets aside the Freeze Orders and Termination Letters as violative of the First Amendment," Boston federal judge Allison Burroughs said in her order.

"All freezes and terminations of funding to Harvard made pursuant to the Freeze Orders and Termination Letters on or after April 14, 2025 are vacated and set aside."

The ruling also bars the administration from using the same reasoning to cut funding in the future.

Albany Law School Professor Ray Brescia told AFP that despite the overwhelming legal victory Wednesday, Harvard may still follow the example of Columbia University and settle with the administration.

Trump "could go back to the negotiating table and offer Harvard a better deal than they have been offering. I think that there has been some talk about a $500 million settlement," he said.

"People settle cases all the time for lots of reasons, even if they think they are 100 percent right."

Harvard president Alan Garber said that "even as we acknowledge the important principles affirmed in today's ruling, we will continue to assess the implications of the opinion."

The ruling "validates our arguments in defense of the University's academic freedom," he added.

- 'Smokescreen' for university 'assault' -

In her ruling, Burroughs pointed to Harvard's own admissions in legal filings that there had been an issue of antisemitism on campus -- but said the administration's funding cuts would have no bearing on the situation.

"It is clear, even based solely on Harvard's own admissions, that Harvard has been plagued by antisemitism in recent years and could (and should) have done a better job of dealing with the issue," she wrote.

"That said, there is, in reality, little connection between the research affected by the grant terminations and antisemitism."

The judge, appointed by Democratic former president Barack Obama, said evidence suggests Trump "used antisemitism as a smokescreen for a targeted, ideologically motivated assault on this country's premier universities."

White House spokeswoman Liz Huston said "this activist Obama-appointed judge was always going to rule in Harvard's favor."

"Harvard does not have a constitutional right to taxpayer dollars... We will immediately move to appeal this egregious decision," she said.

Trump had sought to have the case heard in the Court of Federal Claims instead of in the federal court in Boston, just miles away from the heart of the university's Cambridge campus.

The Ivy League institution has been at the forefront of Trump's campaign against top universities after it defied his calls to submit to oversight of its curriculum, staffing, student recruitment and "viewpoint diversity."

Trump and his allies claim that Harvard and other prestigious universities are unaccountable bastions of liberal, anti-conservative bias and antisemitism.