Homeland Security Secretary John F. Kelly, who is named in court challenges, speaking about the immigration order on Tuesday. (Andrew Harnik/AP)

Attorneys general in four states moved this week to join the burgeoning court battle over President Trump’s immigration order, which has prompted intense legal action since he signed it last week.

Trump’s order temporarily bans people from seven Muslim-majority countries from entering the United States and suspends admission for almost all refugees for 120 days, a sweeping move that prompted confusion and anxiety in airports around the world as travelers were detained, barred from flights or otherwise left in limbo.

During the ban’s chaotic rollout over the weekend, attorneys general from 16 states issued a joint statement denouncing the ban as “unconstitutional, un-American and unlawful.” They also expressed confidence the order would be struck down in the courts, suggesting that more lawsuits could join legal challenges already filed by groups including the American Civil Liberties Union and Council on American-Islamic Relations.

This week, attorneys general in Washington state, Massachusetts, New York and Virginia stepped into that arena, filing or seeking to join lawsuits challenging the measure’s constitutionality in federal courts.

Hundreds of lawyers descend on airports to offer free help after Trump’s executive order

On Monday, Bob Ferguson (D), Washington state’s attorney general, became the first state official to challenge Trump’s measure when he filed a lawsuit in federal court fighting the order.

His lawsuit alleged broad, constitutional concerns with the order as well as its impact on Washington. The complaint states that Trump’s order “is separating Washington families, harming thousands of Washington residents, damaging Washington’s economy, hurting Washington-based companies, and undermining Washington’s sovereign interest in remaining a welcoming place for immigrants and refugees.”

San Francisco sues Trump over order on sanctuary cities

Trump administration officials, who have defended the order as being necessary for national security, also have insisted that it is legally sound. Sean Spicer, the White House press secretary, said Monday he is confident the administration would prevail against any legal challenges.

This debate spilled into remarkable view Monday evening, as Sally Yates, the acting U.S. Attorney General and a holdover from the Obama administration, told Justice Department lawyers not to defend challenges to the order because she was not convinced it was lawful. Trump quickly fired her, assailed her in a statement and replaced her with a U.S. attorney who said he would enforce the directive.

Trump has fired the acting attorney general who ordered Justice Dept. not to defend president’s travel ban

Stephen Miller, the senior policy adviser said to have written the order, told Fox News that Yates was “refusing to defend the lawful powers of the president” and said he had no doubt about the measure’s legality.

Two more attorneys general followed Ferguson’s example on Tuesday. Massachusetts Attorney General Maura Healey (D) announced that her office was joining a lawsuit filed by the American Civil Liberties Union of Massachusetts and private immigration lawyers. That lawsuit was filed on behalf of two associate professors from the University of Massachusetts at Dartmouth who were detained at Boston’s Logan Airport over the weekend.

About 17,000 of America's international students come from the seven predominantly Muslim countries that President Trump banned from entering the country with his Jan. 27 executive order. Now some students and professors are unsure of their fate. The Post's Joe Heim tells you more. (Video: Monica Akhtar/The Washington Post, Photo: Scott Eisen, Getty Images/The Washington Post)

Universities grappling with impact of Trump’s immigration ban

“The president’s executive order is a threat to our Constitution,” Healey said in a statement. “Rather than protecting our national security, it stigmatizes those who would lawfully emigrate to our state.”

In New York, Attorney General Eric T. Schneiderman (D) — a longtime Trump foe who filed a 2013 suit against the president’s now-defunct real estate seminar program, Trump University, and who is still investigating Trump’s personal charity — said his state was joining a lawsuit filed by the American Civil Liberties Union Foundation and other groups.

Schneiderman vowed to “continue to do everything in my power to not just fight this executive order, but to protect the families caught in the chaos sown by President Trump’s hasty and irresponsible implementation.” In a statement Tuesday, he noted that he was still seeking a full list of people detained by U.S. Customs and Border Protection due to the order.

Later Tuesday, Mark R. Herring (D), Virginia’s attorney general, was among officials filing a motion to intervene in another lawsuit “because innumerable Virginia residents have been and will continue to be subjected to degrading and unlawful treatment under the executive order.”

Also notable is the backing these lawsuits have received. Ferguson’s lawsuit in Washington has the support of two high-profile tech giants based in that state: Microsoft and Amazon (Amazon chief executive Jeffrey P. Bezos, who has spoken out against the order, owns The Washington Post.) In Massachusetts, Healey’s decision to challenge Trump’s order was endorsed by Gov. Charlie Baker, a Republican governor who said over the weekend that he opposes the ban. Baker had also sharply criticized Trump’s proposal during the presidential campaign to ban all Muslims from the United States.

Baker said in a statement backing Healey’s challenge that he believes the ban would endanger the commonwealth’s place as “a global community.”

“The recent executive order puts this at risk, will not improve our security, and the lack of guidance associated with an abrupt and overwhelming decision is problematic for all involved,” he said.

Further reading:

Trump and his aides keep justifying the entry ban by citing attacks it couldn’t have prevented

Trump administration says 872 refugees will be allowed in the U.S. this week

Judge halts deportations as refugee ban causes worldwide furor