President Trump denounced arguments against his immigration order as “disgraceful” on Wednesday — a day after three federal appellate judges lobbed critical inquiries at those challenging and defending the plan — and suggested a ruling against his administration would be based on politics and not a fair reading of the law.

In a speech to law enforcement officials in Washington, Trump argued his executive action is clearly legal and read aloud the relevant part of the law, which he called “so simple and so beautifully written and so perfectly written.”

“I watched last night, in amazement, and I heard things that I couldn’t believe, things that really had nothing to do with what I just read,” he said. “And I don’t ever want to call a court biased, so I won’t call it biased. And we haven’t had a decision yet. But courts seem to be so political and it would be so great for our justice system if they would be able to read a statement and do what’s right.”

Trump insisted the order was within his executive powers and “a bad high school student would understand this.” The court said it would not issue a decision Wednesday but previously indicated a ruling could come this week.

The panel from the U.S. Court of Appeals for the 9th Circuit on Tuesday aggressively questioned a Justice Department lawyer about what he considered the limits on the president’s power and what evidence Trump relied upon in temporarily barring refugees and citizens of seven Muslim-majority countries from entering the United States.

(Dalton Bennett,Ahmed Deeb/The Washington Post)

But the panel similarly interrogated Washington state’s solicitor general, who is challenging the president’s directive, over what evidence he had to demonstrate religious discrimination and whether a lower-court judge’s freeze on the ban was too broad.

The court said it expects to make a decision on the matter “probably this week,” and Judge Michelle Taryn Friedland promised rapid consideration. The ruling could affect tens of thousands of travelers whose visas were revoked by the initial executive order, then restored after U.S. District Judge James L. Robart in Seattle put a nationwide stop to it.

The issue of whether the order is allowed to remain in place while legal challenges continue is likely to end up at the Supreme Court. But it will be harder for the Trump administration to prevail at the high court if the appeals court rules that a nationwide halt is warranted.

The broad legal question is whether Trump acted within his authority in blocking the entry of people from Iraq, Iran, Somalia, Sudan, Libya, Syria and Yemen, or whether his order essentially amounts to a discriminatory ban on Muslims. The judges must also weigh the harm the ban imposes and whether it is proper for them to intervene in a national security matter on which the president is viewed as the ultimate authority.

Earlier Wednesday, Trump added to his barrage of comments decrying the challenge to the order, and casting blame if the decision does not go his way. “If the U.S. does not win this case as it so obviously should, we can never have the security and safety to which we are entitled,” Trump tweeted. “Politics!”

Later, before his address to the police chiefs and sheriffs, Trump appeared to describe the legal challenges as “horrible, dangerous and wrong.”

Justice Department lawyer August E. Flentje argued Tuesday that the order was “well within the president’s power,” asserting that Congress and a previous administration had designated the seven affected countries as having problems with terrorism — albeit in a different context.

Some of the judges, though, seemed wary of that claim. Friedland, who was appointed by President Barack Obama, asked Flentje if the government had “pointed to any evidence connecting these countries with terrorism.”

Judge Richard Clifton, a President George W. Bush appointee, noted that the government already had processes in place to screen people coming from those countries and asked, “Is there any reason for us to think that there’s a real risk or that circumstances have changed such that there’s a real risk?”

“The president determined that there was a real risk,” Flentje responded.

Washington state Solicitor General Noah Purcell argued that the government was essentially asking the court to “abdicate” its role as a check on the executive branch, and he asserted that reinstating the ban would “throw the country back into chaos.”

But Purcell, too, faced critical questions. Clifton said that he was having “trouble understanding why we’re supposed to infer religious animus when in fact the vast majority of Muslims would not be affected” — a key point, as the state is trying to demonstrate that Trump’s order is intentionally discriminatory and runs afoul of the Constitution.

Purcell pointed to public statements from Trump and his allies. Former New York mayor Rudolph W. Giuliani, for example, recently said: “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.’ ”

Flentje disputed that the order is a Muslim ban, and he said the judges should limit their consideration to the executive order itself.

“It is extraordinary to enjoin the president’s national security determination based on some newspaper articles, and that’s what has happened here,” he said.

[Federal appeals court decides to schedule a hearing on Trump travel order]

Whichever side loses is sure to take the fight to the Supreme Court. That traditionally has been solid ground for presidents. Justices often defer to a president on matters of immigration and national security, because of his constitutional powers and an additional grant of authority from Congress.

The politically divisive fight comes as the Supreme Court remains shorthanded following the death of Justice Antonin Scalia nearly a year ago; the four Democratic-appointed liberals and four Republican-appointed conservatives often split.

Trump said at a White House event Tuesday that he was prepared to elevate the dispute as needed.

“We’re going to take it through the system,” he told reporters. “It’s very important for the country … We’ll see what happens. We have a big court case. We’re well represented.”

Flentje did offer something of a compromise for the judges Tuesday, saying they could limit the lower-court judge’s ruling to foreigners previously admitted to the country who were abroad now or those who wished to travel and return to the United States in the future.

Purcell countered that officials had not explained how they would practically implement such an order.

In addition to Clifton and Friedland, the case was heard by William C. Canby Jr., who was appointed by President Jimmy Carter. The hearing was conducted via telephone, with Friedland listening from San Jose, Canby from Phoenix and Clifton from Hono­lulu.

If those judges turn down the administration’s appeal and the matter moves immediately to the Supreme Court, the argument would be only on the temporary restraining order, and it would require five justices to reverse the lower court’s actions.

The high court faced a similar issue last term, when a Texas judge imposed a nationwide halt on an executive action from Obama that would have shielded more than 4 million immigrants who were in the country illegally, but who met certain requirements to get work permits. The justices then split 4 to 4 on the matter.

If five justices could not agree, the case would return to Robart, the district judge, to decide whether Trump’s order should be permanently enjoined. The fight up the legal ladder would then begin anew — possibly taking months, past when the travel ban is set to expire.

Homeland Security Secretary John F. Kelly predicted Tuesday that the administration would prevail in its bid to reinstate the executive order and said judges might be considering the matter from an “academic,” rather than a national security, perspective.

“Of course, in their courtrooms, they’re protected by people like me,” he said.

Testifying before the House Homeland Security Committee, Kelly forcefully defended the measure as a necessary “pause” so officials could improve vetting procedures. He said that it is “entirely possible” that dangerous people are now entering the country with the order on hold — as Trump has said via Twitter — and that officials might not know about them until it is too late.

“Not until the boom,” he said when asked if he could provide evidence of a dangerous person coming into the country since the ban was suspended.

[Trump and his aides keep justifying the entry ban by citing attacks it couldn’t have prevented]

Kelly’s view does not reflect the consensus of the national security community. Ten high-ranking diplomatic and security officials — among them former secretaries of state John F. Kerry and Madeleine Albright, former CIA director Leon E. Panetta, and former CIA and National Security Agency director Michael V. Hayden — said in a legal filing that there was “no national security purpose” for a complete barring of people from the seven affected countries.

Kelly also acknowledged Tuesday that if he were given a second chance, he might do things differently in rolling out the order. That stands somewhat in contrast to Trump’s recent assertion to Fox News Channel’s Bill O’Reilly that the implementation was “very smooth,” and it is important because — if the appeals court reinstates the ban — Kelly might get another crack at implementation.

“In retrospect, I should have — this is all on me, by the way — I should have delayed it just a bit, so that I could talk to members of Congress, particularly the leadership of committees like this, to prepare them for what was coming, although I think most people would agree that this has been a topic of President Trump certainly during his campaign and during the transition process,” Kelly said.

He later said, though, that most of the confusion that followed the signing of the order was attributable to court orders and occurred not among Customs and Border Protection officers but among protesters in airports. After people were initially detained and deported, demonstrators packed airports to voice their displeasure, and civil liberties and immigration lawyers filed lawsuits across the country.

Many of those suits are ongoing, with lawyers keeping a close eye on the proceedings at the 9th Circuit. On Tuesday, a group of lawyers asked a federal judge in New York to force the government to turn over a list of those who had been detained or deported, as the court had previously ordered officials to do. The government has said no one is being detained and has debated what information it is required to provide.

“Noncompliance of a court order is very serious, especially where people’s lives are at stake,” said Lee Gelernt, deputy director of the ACLU’s Immigrants’ Rights Project. “We filed this motion to enforce because the government left us no choice.”

John Wagner contributed to this report.