BOSTON: A federal judge on Monday blocked US President Donald Trump’s administration from implementing a new rule that would limit how long foreign students ​and journalists can remain in the US without applying for extensions.

US District Judge F. Dennis Saylor in Boston ruled in favor of a coalition of unions and higher education advocacy groups a day before the Department of Homeland Security’s rule was set to take effect.

Saylor said DHS adopted the policy based on “exceptionally weak” rationales. The agency had cited national security and the need to ‌prevent fraud ‌in the visa program, but the ​judge ‌found it ⁠had not ​adhered ⁠to its legal obligations to engage with concerns about a policy change or consider less burdensome alternatives.

DHS did not immediately respond to a request for comment.

The judge, an appointee of Republican President George W. Bush, wrote that the rule upended a system through which the US for nearly five decades had issued visas to foreign students ⁠for their “duration of status.”

That system, he said, has ‌permitted tens of millions of foreign ‌students and researchers to come to ​the US, leading to “groundbreaking research ‌in science, medicine, and technology, substantial economic growth, and a host ‌of other benefits, often on a vast scale.”

Saylor said the rule DHS adopted in July seeks to replace that system with one that would substantially restrict the overall number of foreign students, professors and journalists in the ‌country.

Under the rule, F visas for international students and J visas that allow visitors on cultural ⁠exchange programs ⁠to work in the US would be capped at four years, while I visas for journalists, which currently can last years, would be up to 240 days.

About 1.6 million people currently have F visas and another 500,000 have J visas. Major research universities like Massachusetts Institute of Technology and Harvard have large percentages of foreign students, particularly at the graduate level, the judge noted.

If the rule took effect, such universities would likely suffer hundreds of millions of dollars in costs and enrollment would decline, Saylor said.

“The damage ​to the higher education system ​and to the economy of the United States is likely to be catastrophic,” Saylor wrote.