Harvard and MIT say withdrawing visas from foreign students whose courses move fully online is "chaos".
A socially-distanced celebration of law-school graduation at Harvard in May
Two elite US universities are suing immigration services over a decision to withdraw visas from foreign students whose courses move fully online.
Harvard and the Massachusetts Institute of Technology filed the lawsuit against Homeland Security and Immigration and Customs Enforcement (ICE).
Harvard President Lawrence Bacow said the visa move's "cruelty [is] surpassed only by its recklessness".
Many colleges are moving courses online amid the coronavirus outbreak.
Harvard had on Monday announced it would hold all classes online for the autumn term, with only 40% of undergraduates housed on campus.
The decision from ICE, the federal law enforcement agency within Homeland Security, came shortly after that, saying students could face deportation unless they changed to an institution with in-person tuition.
President Donald Trump on Tuesday lashed out at Harvard, calling its move online "ridiculous". He has been adamant that US schooling should return to normal in the autumn term.
What's in the two universities' lawsuit?
It was filed with the district court in Boston on Wednesday morning, Harvard's student newspaper, The Harvard Crimson, reported, seeking a temporary restraining order and preliminary and permanent injunctive relief against the visa decision.
The lawsuit argues that ICE's move "threw Harvard and MIT - indeed, virtually all of higher education in the United States - into chaos".
It says ICE's action "proceeded without any indication of having considered the health of students, faculty, university staff, or communities" and leaves "hundreds of thousands of international students with no educational options within the United States".
"We believe that the ICE order is bad public policy, and we believe that it is illegal,", Mr Bacow said.
What does the visa move mean?
The Student and Exchange Visitor Programme, which is operated by ICE, had introduced a temporary exemption to allow students whose courses had moved online for the spring and summer semesters to remain in the US.
However, the exemption will not be extended into the new academic year.
The decision affects students who are in the US on F-1 and M-1 visas, according to the ICE statement.
According to the Chronicle of Higher Education, 9% of US universities are planning to teach all their classes online in the autumn, although this could change in the coming months.
Democratic Senator Elizabeth Warren described ICE's move as "senseless, cruel, and xenophobic".
But President Trump railed at Harvard, saying of its online move: "I think it's ridiculous, I think it's an easy way out and I think they ought to be ashamed of themselves."
Her added: "It's so important that children at this age especially that they're together, that they're together on campus and that's what we're striving for." BBC
Foreign students whose courses move completely online may have to move universities to stay in the US.
Some foreign students may need to move to a university with in-person classes to stay in the US.