(In this Jan. 31 story, in 11th paragraph corrects to show two Iranian plaintiffs are a man and a woman, not two men)

BOSTON/SAN FRANCISCO (Reuters) - Legal challenges to President Donald Trump’s first moves on immigration spread on Tuesday, with three states suing over his executive order banning travel into the United States by citizens of seven majority-Muslim countries.

Massachusetts, New York, Virginia and Washington state joined the legal battle against the travel ban, which the White House deems necessary to improve national security.

The challenges contend the order violated the U.S. Constitution’s guarantees of religious freedom.

San Francisco became the first U.S. city to sue to challenge a Trump directive to withhold federal money from U.S. cities that have adopted sanctuary policies toward undocumented immigrants, which local officials argue help local police by making those immigrants more willing to report crimes.

The legal maneuvers were the latest acts of defiance against executive orders signed by Trump last week that sparked a wave of protests in major U.S. cities, where thousands of people decried the new president’s actions as discriminatory.

Both policies are in line with campaign promises by Republican businessman-turned-politician Trump, who vowed to build a wall on the Mexican border to stop illegal immigration and to take hard-line steps to prevent terrorist attacks in the United States.

The restrictions on the seven Muslim-majority countries and new limits on refugees have won the support of many Americans, with 49 percent of respondents to a Reuters poll conducted Monday and Tuesday saying they agreed with the order, while 41 percent disagreed.

Massachusetts contended the restrictions run afoul of the establishment clause of the 1st Amendment of the U.S. Constitution, which prohibits religious preference.

Slideshow ( 8 images )

“At bottom, what this is about is a violation of the Constitution,” Massachusetts Attorney General Maura Healey said of the order halting travel by people with passports from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen for 90 days. The order also barred resettlement of refugees for 120 days and indefinitely banned Syrian refugees.

“It discriminates against people because of their religion, it discriminates against people because of their country of origin,” Healey said at a Boston press conference, flanked by leaders from the tech, healthcare and education sectors who said that the order could limit their ability to attract and retain highly educated workers.

Massachusetts will be backing a lawsuit filed over the weekend in Boston federal court by two Iranian men who teach at the University of Massachusetts at Dartmouth. A federal judge blocked the government from expelling those men from the country and halted enforcement of the order for seven days, following similar but more limited moves in four other states.

The attorneys general of New York and Virginia also said their states were joining similar lawsuits filed in their respective federal courts challenging the ban.

“As we speak, there are students at our colleges and universities who are unable to return to Virginia,” Virginia Attorney General Mark Herring told reporters. “This is not an action I take lightly, but it is one I take with confidence in our legal analysis.”

On Monday, liberal-leaning Washington state became the first U.S. state to have its attorney general initiate a lawsuit against Trump to challenge the travel ban.

Multiple foreign nationals have also filed lawsuits challenging the ban. They included one filed in Colorado on Tuesday by a Libyan college student and two filed in Chicago, including one on behalf of an Iranian father of three children all living in Illinois.

Protests against Trump’s executive action continued on Tuesday in several cities.

Slideshow ( 8 images )

A crowd of several thousand demonstrators gathered at the federal courthouse in Minneapolis, chanting “Hey, hey, ho, ho Muslim ban has got to go!” Dozens of protesters chanted the same slogan at Los Angeles International Airport, and more than 400 demonstrators gathered in downtown Miami to protest both the travel ban and Trump’s crackdown on sanctuary cities.

SANCTUARY CHALLENGE

San Francisco City Attorney Dennis Herrera filed suit over Trump’s order threatening to cut funds to cities with sanctuary policies, a move that could stop the flow of billions of dollars to major U.S. population centers including New York, Los Angeles and Chicago.

“If allowed to be implemented, this executive order would make our communities less safe. It would make our residents less prosperous, and it would split families apart,” Herrera said.

Sanctuary cities adopt policies that limit cooperation, such as refusing to comply with U.S. Immigration and Customs Enforcement detainer requests. Advocates of the policies say that, beyond helping police with crime reporting, they make undocumented immigrants more willing to serve as witnesses if they do not fear that contact with law enforcement will lead to their deportation.

Both the San Francisco and Massachusetts actions contend that Trump’s orders in question violate the 10th Amendment of the U.S. Constitution, which states that powers not granted to the federal government should fall to the states.

Michael Hethmon, senior counsel with the conservative Immigration Reform Law Institute in Washington, called the San Francisco lawsuit a “silly political gesture,” noting that prior federal court decisions make clear that the U.S. government “can prohibit a policy that essentially impedes legitimate federal programs.”