Scott Olson via Getty Images Khaled Haj Khalaf kisses his grandaughter Shams after she arrived with her mother and father at O'Hare Airport on a flight from Istanbul on Tuesday. Shams' parents had spent five years in a Syrian refugee camp in Turkey. Their trip to the United States was suspended after President Donald Trump signed an executive order stopping Syrian refugees from entering the U.S..

Less than three weeks since President Donald Trump took office, lawyers for his administration seemed to have a hard time Tuesday convincing a panel of federal appeals judges to reinstate his executive order excluding refugees and immigrants from seven Muslim-majority nations from entering the U.S.

The order imposing a de facto travel ban caused widespread chaos in the days after its implementation, and it’s been the target of protests and dozens of lawsuits across the country. Last week, a federal judge in Seattle blocked the order’s implementation nationwide, leading the Department of Justice to immediately appeal.

At its most basic, the hourlong hearing at the U.S. Court of Appeals for the 9th Circuit, based in San Francisco, centered on whether the judge who temporarily put the brakes on the travel ban used the proper legal standard when he decided to bar the federal government from enforcing the restrictions.

But even to decide that largely technical issue ― the legality of the executive order will be weighed at a later stage ― the three judges who heard from the Justice Department and the states that sued the administration, Washington and Minnesota, had to probe some deeper questions: Whether the president has “unreviewable” authority given to him by Congress to implement the travel ban, and whether the two states are constitutionally allowed to contest his immigration determinations in court.

“This is a traditional national security balance that’s assigned to the political branches and the president,” said August Flentje, a longtime DOJ lawyer who at times hesitated when pressed by the judges to explain if the president’s power over immigration is as unfettered as the administration makes it out to be.

Flentje insisted that U.S. District Judge James Robart, in blocking the travel ban last month, “disturbed” the balance with the other branches of government ― a disruption that caused “irreparable harm” to the Trump administration’s ability to protect the country.

But U.S. Circuit Judge Michelle Friedland seemed skeptical that courts should simply stay out of these kinds of disputes, no matter how sensitive they might seem at first blush.

“Are you arguing that the president’s decision in that regard is unreviewable?” the judge asked Flentje, who later conceded that “there are obviously constitutional limitations” to what the president may do with his authority.

Trump and his administration have repeatedly come under scrutiny over whether his executive order amounts to a so-called Muslim ban, and statements he and his associates have made during the campaign or since loomed large over the hearing.

At one point, Friedland wondered whether the court should consider those statements as proof that the travel ban was instituted with “bad faith,” while U.S. Circuit Judge Richard Clifton suggested that comments made by the likes of Rudy Giuliani about how the order came to be could serve as evidence of discriminatory motive.

“Do you deny that those statements were made?” Clifton asked of the DOJ lawyer, who elsewhere in the proceedings said the court should simply look to the “four corners” of Trump’s executive order ― and not to things beyond what it says.

Washington Solicitor General Noah Purcell’s burden was different than that of the DOJ: to show that Trump’s order causes his state and Minnesota “irreparable harm” ― and that reinstating the ban would simply bring more disruption to state universities, businesses and residents who depend on the states for essential services.

But on the broader point about the order’s legality, Purcell said the weight of the states’ allegations, even at this early stage in the case, indicated that the travel ban is likely unconstitutional.

“Here we’ve alleged very plausibly and with great detail that this was done to favor one religious group over another,” Purcell said. Among other violations, the states have asserted that Trump’s travel restrictions violate the Constitution’s guarantees of religious freedom and equal protection of the laws.

The 9th Circuit, which is expected to rule later this week, probably won’t touch the merits of those claims. Instead, the court is likely to issue a procedural ruling indicating whether the lower court’s temporary order should be lifted or upheld ― which would be followed by more evidence-gathering, more hearings, and a more substantive ruling by Robart, the district judge.

However that plays out, the controversy over the travel ban is likely to land before the Supreme Court, which remains one member short. Maybe by then, Trump’s nominee to the high court, Neil Gorsuch, will be seated to consider the case.

Because of the high-profile nature of the dispute, the 9th Circuit made audio of the hearing available live on YouTube, and it was separately carried by CNN. By the time it ended, the YouTube feed had more than 135,000 listeners.