Image copyright Getty Images Image caption A lawyer holds a sign offering his services to those affected by President Trump's immigration order, at Los Angeles International Airport

Senate Majority Leader Mitch McConnell may have offered the most prescient reaction to President Donald Trump's executive order suspending refugee resettlement and blocking individuals from seven majority-Muslim nations from entering the United States.

"It's going to be decided in the courts as to whether or not this has gone too far," he said.

To make matters worse for Mr Trump, he has had difficulties with his own Justice Department.

He fired acting US Attorney General Sally Yates after she questioned the legality of the immigration ban. Ms Yates was replaced by Dana Boente, US attorney for the Eastern District of Virginia, who has directed the department to enforce Mr Trump's order.

Even with government lawyers on his side, Mr Trump's presidential authority on immigration issues is broad, but it's not without limitations - and those limitations are interpreted and enforced by the US judicial system. In the case of Mr Trump's immigration action, that's already happening.

Media playback is unsupported on your device Media caption Trump voters say US president is 'doing a fabulous job'

In the days after Mr Trump signed the executive order, federal judges in four states granted the request of the American Civil Liberties Union (ACLU) for temporary injunctions prohibiting individuals who were detained at US airports from being sent back to their countries of origin.

"The petitioners have a strong likelihood of success in establishing that the removal of the petitioner and others similarly situated violates their rights to Due Process and Equal Protection guaranteed by the United States Constitution," New York federal judge Ann Donnelly writes in her court decision.

Then, on 3 February, a judge in Seattle went one step farther, responding to a lawsuit filed by the states of Washington and Minnesota with a national injunction suspending implementation of Mr Trump's immigration order in its entirety, pending a trial on its merits.

"At the end of the day, either you're abiding by the Constitution or you are not," Washington Attorney General Bob Ferguson said. "And in our view, the president is not adhering to the Constitution when it comes to this executive action."

Read more

Although the rulings have been heralded as victories for Mr Trump's opponents, they are temporary in nature. The major frontal assaults on the order are still in their infancy.

The Council on American-Islamic Relations (Cair) has also filed a legal case against what it terms the "Muslim Exclusion Order" on behalf of a group of Muslim-Americans and unnamed citizens of nations covered by the ban currently residing in the US.

Media playback is unsupported on your device Media caption President Trump: "A very good day"

The ACLU, fresh off its injunction success, is also gunning to take down the entire order.

Here are some of the ways they're building their cases.

The Constitution

Washington state, Cair, and others argue that by implicitly singling out those of the Muslim faith, Mr Trump's order amounts to an establishment of a state religion, in violation of the First Amendment of the Constitution. ("Congress shall make no law respecting an establishment of religion.").

Media playback is unsupported on your device Media caption White House makes ultimatum to diplomats

They cite comments by Mr Trump on the campaign trail, and his political surrogates, along with the exemption that the immigration order provides for religious minorities as evidence of discriminatory intent - even though the order did not mention Muslims or Christians by name.

Although Mr Trump backed away from his pledge to ban US entry to all Muslims, writes the ACLU's David Cole, he "never gave up his focus on the religion of Islam. Friday's executive orders are of a piece with his many anti-Muslim campaign promises."

Mr Trump's challengers also argue the action violates the Fifth and Fourteenth Amendment guarantees of "due process of the law" by denying entry to individuals who have valid visas.

"The very concept of due process emerged from a desire to limit the king's ability to order unlawful arrests," writes Mark Joseph Stern in Slate. "It appears we are returning to the days when the head of state can detain purported threats without a whiff of evidence that they have broken a law."

The conservative counter-argument to these claims is straightforward. Foreign nationals on foreign soil have no grounds for claiming constitutional protections.

"Foreigners have no right under our Constitution to demand entry to the United States or to challenge any reason we might have to refuse them entry, even blatant religious discrimination," writes Dan McLaughlin in the National Review.

Federal law

In his order, Mr Trump quotes a 1952 immigration law that gives the president the ability to suspend entry "of all aliens or any class of aliens" into the US when he deems it "detrimental to the interests of the United States."

A 1965 revision of the law, however, says individuals cannot be "discriminated against in the issuance of an immigrant visa" because of their "race, sex, nationality, place of birth or place of residence".

Media playback is unsupported on your device Media caption Donald Trump supporters give their views on the ban from New York's Staten Island

David J Beir, an immigration policy analyst at the Cato Institute, contends that this language means discriminating against immigrants based on where they are from - whether it's Iraq, Sudan or Canada - is illegal.

"Mr Trump may want to revive discrimination based on national origin by asserting a distinction between 'the issuance of a visa' and the 'entry' of the immigrant," he writes. "But this is nonsense. Immigrants cannot legally be issued a visa if they are barred from entry."

He did note, however, that the language applies only to immigrants. Tourists, students and other temporary residents could still be kept out.

Mr Beir's view is far from universal, however. Andrew McCarthy, writing in the National Review, says presidential power supersedes congressional legislation in this case.

Image copyright AFP Image caption Demonstrators protest against President Trump outside the US Supreme Court

"At issue is a matter related to the conduct of foreign affairs - a matter of the highest order of importance since it involves foreign threats to national security," he writes. "If there were a conflict here, the president's clear constitutional authority to protect the United States would take precedence over Congress's dubious authority to limit the president's denial of entry to foreign nationals."

He also contends that when Congress passed - and President Barack Obama signed - legislation exempting individuals who had visited the seven countries in question from the Visa Waiver Programme, it was effectively authorising discrimination based on country of origin, at least for those particular nations.

Cair is also arguing that Mr Trump's order violates the Administrative Procedure Act, which says a government action can't be "arbitrary, capricious, an abuse of discretion or otherwise not in accordance with law" or "unsupported by substantial evidence". It's a particular provision that has been used to strike down past executive actions by President George W Bush and Mr Obama.

International law

During a phone call with Mr Trump, German Chancellor Angela Merkel told the president his immigration order may also run afoul of international commitments.

Image copyright AFP Image caption A protester holds up a sign outside the highest court in the land

"The Geneva refugee convention requires the international community to take in war refugees on humanitarian grounds," Merkel spokesman Steffen Seibert wrote in a statement. "All signatory states are obligated to do. The German government explained this policy in their call yesterday."

At least so far, no lawsuits have been brought challenging the order on this grounds - although the US Supreme Court has the power to strike down a law or presidential action as contrary to US obligations under international treaties.

"The US has signed and ratified a number of international treaties that prohibit religious and race discrimination in the operation of legal systems, and this extends to operating a migration system in line with international non-discrimination protections," writes Liam Thornton of the University College Dublin.

Some Supreme Court justices have also cited international consensus as informing their interpretation of US law and constitutional principles - although it's a view that has been roundly criticised in conservative legal circles.

A friendly judge

Opponents of Mr Trump's immigration action feel confident that they have a solid legal case against the measure - and there certainly is precedent for federal courts throwing a wrench in the best-laid plans of presidents.

In February 2015, a judge in the south Texas town of Brownsville issued an injunction preventing implementation of President Obama's efforts to offer normalised immigration status to the undocumented families of US citizens and permanent residents.

It took more than a year for the case to reach the US Supreme Court, which then deadlocked on whether to uphold the injunction. The case is still in legal limbo.

All it requires is one judge friendly to the challengers to work a similar number on Mr Trump's actions - and Mr Trump's opponents appear to have found one in Seattle's James Robart. If the appeals courts uphold his stay, it could be a while before the immigration order is re-instated, even if the administration ends up prevailing in the end.

Have you or your family been affected by the entry restrictions? Have you been detained at an airport following the travel ban? Get in touch by emailing haveyoursay@bbc.co.uk.

Please include a contact number if you are willing to speak to a BBC journalist. You can also contact us in the following ways: