California became the first state to sue the Trump administration over a new visa rule that says international students must leave the United States if all their classes are online, the state’s Attorney General Xavier Becerra announced Thursday.

The suit, which is supported by California State University system (CSU) and California Community Colleges officials, claims it unfairly harms international students and puts "themselves, teachers, other students and the community at large at risk of getting and spreading the coronavirus -- or be subject to deportation."

"Shame on the Trump Administration for risking not only the education opportunities for students who earned the chance to go to college, but now their health and well-being as well,” Becerra said in a statement.  “Not on our watch…Today’s lawsuit rests on America’s enduring principle that everyone who works hard and plays by the rules can earn a chance to get ahead. We'll see the Trump Administration in court."

CSU schools plan to mainly hold online classes in the fall due to the virus, The Los Angeles Times reported.

Cal State Chancellor Timothy White called the policy “callous and inflexible,” adding it places thousands of international students into an “extremely difficult position,” The Times reported.

COLLINS URGES DHS TO 'IMMEDIATELY RESCIND' NEW ICE POLICY ON FOREIGN STUDENTS, WARNS OF 'LONG-LASTING HARM' 

Under the new policy, F-1 and M-1 visa holders "must depart the country or take other measures, such as transferring to a school with in-person instruction to remain in lawful status," Immigration and Customs Enforcement said in a statement, according to NBC News.

Sen. Susan Collins, R-Maine, in a letter to Acting Homeland Security Secretary Chad Wolf, called for the extension of an exemption adopted by ICE in March through the end of the 2020-2021 school year. The ICE exemption allowed international students with F-1 visas to attend classes online while retaining their visa status.

"The exemption worked and ought to be extended,” Collins wrote. “Its termination on short-notice is especially troubling given that the Student and Exchange Visitor Program’s (SEVP) new guidance requires colleges and universities to certify by July 15—just one week from now—whether to not fall semester courses will be offered online only, in-person only, or using a hybrid model.”

The rules would also hurt colleges already struggling financially amid the outbreak since many colleges rely on international student tuition. California has more students on international visas than any other state, NBC reported.

“In addition to being cruel, Defendants’ attempt at a policy change to force in-person learning in the middle of a pandemic is absurd and the essence of arbitrary and capricious conduct in violation of the Administrative Procedure Act,” the suit says, according to the Times.

CLICK HERE FOR COMPLETE CORONAVIRUS COVERAGE 

The lawsuit seeks an injunction to block the policy and separately the University of California plans to seek a restraining order as well.

Becerra said it is the 86th lawsuit he’s filed against the administration.

Fox News' Brooke Singman contributed to this report.