Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Legal challenges to President Trump's refugee and traveler executive order make the same argument that doomed President Obama's plan for changing immigration policy — only Congress can do that.

Lawsuits filed in four cities over the weekend — Brooklyn, Boston, Seattle, and Alexandria, Virginia — sought immediate relief for a small number of people arriving in the U.S. with valid visas. The travelers were detained by U.S. Customs and Border Patrol officers who refused to let them in to the county or, in a few cases, ordered them to go back to where they'd come from.

Acting with a pace rarely seen in federal courts, judges issued orders Saturday that were for the most part limited to people held at nearby airports. But an order from Judge Ann Donnelly in Brooklyn applied nationwide, barring the government from sending anyone back who came with a valid visa.

By Sunday night, the immediate legal crisis seemed to have passed. A Department of Homeland Security official said customs and border officers had "cleared out all cases that resulted in individuals who were affected by the order at airports around the country."

Related: Trump Defends His Immigration Ban Amid Uncertainty, Public Outcry

But the process launched by the flurry of weekend court filings has just begun, because the challengers also argue that the president is barred by both the Constitution and federal law from imposing the travel restrictions.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

"The United States is a nation governed by the rule of law and not the iron will of one man. President Trump now has learned that we are democratic republic where the powers of government are not dictatorial," wrote Anthony Romero of the ACLU, one of several civil liberties groups that sprang into action.

In June, the eight-justice Supreme Court failed to decide a challenge to President Obama's immigration policy in which a lower court had ruled that he overstepped his powers by using executive orders to effect change.

Mark Doss, Supervising Attorney for the International Refugee Assistance Project at the Urban Justice Center speaks on his cell phone at John F. Kennedy International Airport in Queens, New York on Jan. 28, 2017. Reuters

The lawsuits, most prominently the one filed in Brooklyn — a federal judicial district that includes New York's JFK Airport — argue that the executive order violates the Constitution's guarantee of equal protection.

They also say the order is barred by a provision of federal immigration law that says no one can be "discriminated against in the issuance of an immigrant visa because of the person's race, sex, nationality, place of birth, or place of residence."

Imposing travel restrictions on people coming from seven specific countries, the challengers say, is the opposite of what federal law allows.

Though they did not make a First Amendment claim of discrimination against the Muslim religion, that issue will play a prominent role in court in the weeks to come.

"We have no doubt that the motivation behind the executive order was discriminatory. This was a Muslim ban wrapped in a paper-thin national security rationale," says the ACLU's Romero.

The Trmp administration has yet to respond in any detailed way to the court challenges, but a statement Sunday from the Department of Homeland Security said the Trump order "protects the United States from countries compromised by terrorism and ensures a more rigorous vetting process."

The new policy "ensures we have a functional immigration system that safeguards our national security."

Administration lawyers also cite another provision of federal law that allows the president to "suspend the entry of all aliens or any class of aliens as immigrants or non-immigrants" if the president determines that letting them in would be "detrimental to the interests of the United States." And courts have traditionally given presidents wide latitude in making decisions about national security.

The judge in Brooklyn ordered lawyers for the government and civil liberties groups to submit a round of legal briefs by February 21. Until then, unless new legal challenges arise, the administration can continue operating under the executive order.

Judge Donnelly did not rule on the substance of the constitutional and statutory issues but did say that the challengers "have a strong likelihood of success."

For now, nearly all people hoping to come to the US from Iraq, Syria, Sudan, Iran, Somalia, Libya, and Yemen will be prevented from entering. Airlines and border officials will stop them from boarding U.S.-bound planes or ships.

The order does not apply to U.S. citizens, and administration officials said over the weekend that lawful permanent residents, who hold green cards, may be subjected to screening upon arrival but will be admitted unless there is a specific reason to block them. The DHS said the executive order also does not apply to travelers on diplomatic visas, or visas for NATO or UN work.

Attorneys general from 16 states have joined in condemning the executive order, and some said individual states might challenge it by claiming that it was harmful to hospitals or universities by preventing doctors or scholars from entering the country.

The first state-level action came from Washington on Monday Afternoon, where Attorney General Bob Ferguson's office announced a suit asking a federal judge to declare unconstitutional key provisions of President Trump’s immigration executive order.

"No one is above the law — not even the president," Ferguson said in a statement. "And in the courtroom, it is not the loudest voice that prevails. It’s the Constitution."