Seventeen states, including Minnesota, and the District of Columbia sued the Trump administration Monday, seeking to block a new rule that would revoke the visas of foreign students who take classes entirely online in the fall.

The rule, issued a week ago, would upend months of careful planning by colleges and universities, the lawsuit says, and could force many students to return to their home countries during the pandemic, where their ability to study would be severely compromised.

“The Trump administration didn’t even attempt to explain the basis for this senseless rule, which forces schools to choose between keeping their international students enrolled and protecting the health and safety of their campuses,” Massachusetts Attorney General Maura Healey said in a statement announcing the suit, which accuses the administration of violating the Administrative Procedure Act.

The action, filed in U.S. District Court in Boston, is the latest legal effort to contest the federal edict, which has been described by states and universities in court filings as a politically motivated attempt by the Trump administration to force universities to hold in-person classes this fall, even as many have announced they will remain largely online because of the pandemic.

California filed its own lawsuit last week, after Harvard University and the Massachusetts Institute of Technology had already gone to court seeking to block the new rule. Arguments in the Harvard and MIT case are scheduled to be heard Tuesday, also in Boston.

The federal guidance issued by Immigration and Customs Enforcement, which says foreign students earning their degrees entirely online cannot stay in the United States, has sent students scrambling to enroll in in-person classes that are difficult to find. Many universities are planning to offer a mix of online and in-person classes to protect the health of faculty, students and their surrounding communities during the pandemic.

White House press secretary Kayleigh McEnany defended the administration’s actions last week. “You don’t get a visa for taking online classes from, let’s say, University of Phoenix. So why would you if you were just taking online classes, generally?” she told reporters, adding, “Perhaps the better lawsuit would be coming from students who have to pay full tuition with no access to in-person classes to attend.”

The area represented by the 17 states and the District of Columbia contains 1,124 colleges and universities that in 2019 had enrolled a combined 373,000 international students, who contributed an estimated $14 billion to the economy that year, according to the complaint.

About 40 higher education institutions filed declarations in support of the lawsuit, including the University of Minnesota last week.

The Minnesota State Colleges and Universities has also filed a declaration. MnSCU serves 4,300 international students from around the world on its 54 campuses, which are located in 47 cities and towns throughout Minnesota.

Minnesota Attorney General Keith Ellison said the new rule would strike a blow throughout the entire state. “The economic, social, and cultural value that international students bring to Minnesota has made us one of the most resilient economies in America,” Ellison said in a statement. “They deserve to live with the same dignity and respect that all Minnesotans do.”

Ellison added that the president “has once chosen to divide us instead of unite us.”