Call it a ban. Call it, as the president did on Twitter, “keeping bad people (with bad intentions) out of country!”

Either way, civil liberties lawyers assert, the executive order temporarily barring the entry of refugees and people from seven Muslim-majority countries is unconstitutional. But legal analysts say they might have a tough time proving that in court, even with early legal victories and swelling support from people across the country.

Analysts across the political spectrum say that the president has vast authority to bar the entry of people to the United States, and to do so without the consent of other branches of government.

[Ban or no ban? Trump settles the debate over his executive order.]

The law states that if the president finds that “the entry of any aliens” would be “detrimental” to the country’s interests, he has broad power to impose restrictions.

There are good reasons for that, analysts say. If, for example, the residents of a particular country contracted a deadly, contagious disease, “you would want to shut down travel from that country,” said Leon Fresco, the deputy assistant attorney general for the Office of Immigration Litigation in President Barack Obama’s Justice Department. Fresco said the same power that gives the president authority to do that seems to give President Trump the authority to enforce his ban.

His view is not universal. Acting attorney general Sally Yates, an Obama holdover, declared this week she would not defend the order — a decision that led to her firing — because she was not convinced it was lawful. The ACLU and others have filed several potential class-action claims around the country alleging individual cases of wrongdoing, and attorneys general in four states moved this week to join the burgeoning court battle. Amazon chief executive Jeffrey P. Bezos, who owns The Washington Post, has spoken out against the order.

Civil liberties and immigration lawyers are waging a wide-reaching public and legal resistance campaign — hoping to push the judiciary to overturn what they call antiquated legal precedents and toss the order.

Federal judges have consistently sided with the challengers in early suits, producing a nationwide stoppage on Customs and Border Protection detaining or deporting green-card holders or those with valid visas who arrive at U.S. airports.

A panel of United Nations human rights experts said Wednesday that the order violates the United States’ international human rights obligations. State Department diplomats have signed a memo objecting to Trump’s order, arguing that it will not deter attacks on American soil. After the order first came down, protests erupted at airports across the country. The Homeland Security inspector general announced late Wednesday he would investigation the order’s implementation.

[Civil liberties advocates continue pressing Trump administration on immigration order]

The mass action, analysts said, is intended both to prevent the White House from trying to marginalize individual judges who rule against the administration, as well to show the many other lives affected by the order. That might push the judiciary to a tipping point to conclude that precedents shaped in a pre-civil rights era — founded on rulings such as one upholding the internment of Japanese Americans during World War II and another approving the expulsion of communists — no longer apply.

“Judges look at the newspapers, too,” said Peter J. Spiro, a professor of immigration and constitutional law at Temple University. “The fact that they see spontaneous public unrest about the order, that empowers the courts in pushing back against the administration and finding a way to striking down the law.”

Anthony Romero, executive director of the ACLU, said in an interview this week he believes the order violates the Immigration and Nationality Act, the Administrative Procedure Act, international treaties and the First Amendment. Of particular significance, he said, is an exception to the refu­gee ban for those who are members of a minority religion and who are fleeing a country.

That, Romero and others say, seems to favor non-Muslims. And Trump himself said in a recent interview with CBN News that persecuted Christians would be given priority.

“We’re confident that we can win, and fortunately, President Trump and those around him make it very easy to reveal that bigotry,” said lawyer Gadeir Abbas, who is among those involved in a broad legal challenge to the order.

The ACLU is still haggling with the government over a list of people who were detained when the order first went into effect over the weekend. The government said late Tuesday no one was being detained, though some people might be facing extra processing. The ACLU wants an accounting of those who were once held and those who might have been removed after it filed its lawsuit.

There also remain questions about implementation. Lawyers recently obtained a letter from the State Department that provisionally revokes all nonimmigrant and immigrant visas of nationals of Iraq, Iran, Libya, Somalia, Sudan, Syria and Yemen — which they say demonstrates the effect of the order in a way they did not previously understand.

“It’s shocking, to say the least,” said Susan Cohen, who is working with the ACLU on a case in Massachusetts.

White House press secretary Sean Spicer said Wednesday the administration would dial back its position on green-card holders from the affected countries. They had initially been allowed in only with waivers, which will no longer be needed, Spicer said.

The lawsuits challenging the executive order allege that it is essentially a tool for discrimination that damages states’ interests and violates people’s constitutional rights. The problem, analysts said, is that some, though not all, case law suggests noncitizens outside the United States have no such rights. And in a way, all immigration law is essentially discriminatory.

“The notion that it is unconstitutional to discriminate against foreign nationals based on their national origin is political correctness run amok,” said Stewart Baker, a former Department of Homeland Security assistant secretary for policy in President George W. Bush’s administration. “We admit French nationals without a visa but don’t give the same right to Polish nationals, and we have for decades — without a constitutional challenge.”

Fresco, the Obama Justice Department lawyer, said that although the challengers might argue otherwise, courts are likely to use a low standard to determine whether the order passes muster, essentially asking whether it has any rational basis. The administration, he said, will likely argue that the threat of terrorist attacks justifies the order.

Trump and his aides have cited as evidence in favor of the ban attacks that it probably could not have prevented. But they would face a low burden, analysts said, and have some facts on their side. For example, Abdul Razak Ali Artan, the college student who drove his car into a crowd and then stabbed and slashed people in a spree that injured 11 at Ohio State University in November, was born in Somalia, which is covered by the ban.

“These are countries where there are active anti-U.S. terrorist organizations operating,” Baker said.

Fresco said lawyers for the other side, though, could present evidence that public safety was not the order’s real purpose — pointing to the chaotic rollout and even public comments by those associated with the administration. Trump promised on the campaign trail a “total and complete shutdown of Muslims entering the United States” — and that pledge remains on the campaign website. Former New York City mayor Rudolph W. Giuliani, a vigorous Trump supporter, used the term “Muslim ban” — a term Trump now takes issue with — in talking about the order’s origin in a recent television interview.

“I’ll tell you the whole history of it,” Giuliani said on Fox News. “So when [Trump] first announced it, he said, ‘Muslim ban.’ He called me up. He said, ‘Put a commission together. Show me the right way to do it legally.’ ”

Rachel Weiner, Mark Berman, Glenn Kessler and Abby Phillip contributed to this report.