(Reuters) - The U.S. judiciary is the only branch of our government that frequently restricts its own power. The constitutional system of checks and balances requires the courts to decide when Congress or the president is overreaching. But no one tells the justices of the U.S. Supreme Court, who are appointed for life, that they’re exceeding their constitutional power (except other justices). The system depends on judges acting judiciously.

The Trump administration believes the system failed on Friday, when U.S. District Judge James Robart of Seattle granted a motion by the states of Washington and Minnesota to suspend enforcement of the president’s week-old travel, immigration and refugee policy. The Justice Department’s appeal at the 9th U.S. Circuit Court of Appeals to stay Judge Robart’s order is, fundamentally, a call on federal courts to limit their own authority to review the president’s power to decide who comes into and goes out of this country.

The government’s brief, as I’ll explain, contends the Supreme Court has already conceded its restricted power in opinions that say courts must defer to the president as long as the government offers a legitimate rationale for its immigration decisions. Beyond that, the Trump Justice Department said, judges are intruding on terrain the U.S. Constitution and Congress have reserved for the president, meddling in policy they have no right to control.

Washington and Minnesota responded late Sunday night courts “have both the right and the duty” to examine the motives behind an unprecedented immigration and refugee policy that flouts the Constitution and a Congressional directive against nationality-based discrimination.

The 9th Circuit can decide the case on any number of technicalities – ranging from its jurisdiction to hear the appeal to the standing of Washington and Minnesota to bring claims on behalf of their residents - without reaching the essential question of the scope of court authority to review the president’s immigration policies. But the issue won’t go away with this case. The Trump administration intends to pursue aggressive immigration policies. Judges need to know how closely they can scrutinize the administration’s actions.

President Trump made clear his own view of the appropriate balance of power in a series of Twitter posts this weekend. Deriding Judge Robart – who was appointed by President George W. Bush and confirmed unanimously by the U.S. Senate - as a “so-called judge,” Trump tweeted, “What is our country coming to when a judge can halt a Homeland Security travel ban and anyone, even with bad intentions, can come into U.S.?”

On Sunday, the president once again questioned federal court interference with his national security policy. “Just cannot believe a judge would put our country in such peril,” he tweeted. “If something happens blame him and court system. People pouring in. Bad!”

The president’s comments seem to me to be gratuitously disdainful of Judge Robart’s authority, but his tweets distill the arguments his Justice Department has been making all week in the Washington and Minnesota AG case. The government has warned against “judicial second-guessing” of the president’s discretion in matters of national security, which, it said, Congress codified in immigration law provisions guaranteeing the executive branch’s power to suspend admission to the U.S. when the safety of the nation is at stake.

In the brief filed Saturday, the Justice Department added the argument that judges don’t have access to all of the classified information the president sees, so “courts are particularly ill-equipped to second-guess the president’s prospective judgment about future risks.” According to the Justice Department, judges are committing irreparable harm to constitutional separation-of-powers doctrine when they intrude “on the political branches’ exclusive authority over the admission of aliens.”

To back those arguments, the government cites two Supreme Court opinions, Kleindienst v. Mandel from 1972 and Kerry v. Din from 2015. Both cases were brought by U.S. citizens suing over State Department decisions not to issue visas to particular foreign nationals. In Kleindienst, American professors claimed the government was violating their First Amendment rights by refusing entry to a radical Belgian journalist; in Kerry, a woman married to a former Taliban member asserted the government was obliged to explain its refusal to grant her husband a visa.

In both cases, the Supreme Court said that when the government has a “facially legitimate and bona fide” reason to deny a visa, courts should not probe the executive branch’s exercise of its discretion. “This reasoning has particular force in the area of national security, for which Congress has provided specific statutory directions pertaining to visa applications by noncitizens who seek entry to this country,” wrote Justice Anthony Kennedy in a concurrence in the Kerry case.

The Justice Department’s position is not unreasonable. Boston federal district judge Nathaniel Gorton, who declined on Friday to extend a temporary restraining order barring enforcement of the Trump policies, agreed with the government’s restricted view of court oversight of immigration policy. (And was hailed in a yet another tweet from President Trump over the weekend.) “The president has exercised his broad authority … to suspend entry of certain aliens purportedly in order to ensure that resources are available to review screening procedures and that adequate standards are in place to protect against terrorist attacks,” Gorton wrote, citing Kleindienst among other cases.

But as Washington and Minnesota explained Sunday night in their 9th Circuit response to the Justice Department, the Supreme Court doesn’t always give the executive branch a free pass when it comes to national security. Most notably, in a series of decisions in the early 2000s, the justices granted constitutional rights to detainees held at Guantanamo Bay, over ardent opposition from the George W. Bush administration. “Courts routinely review executive decisions with far greater security implications” than the Trump administration immigration policy, the states’ brief said.

Moreover, according to Washington and Minnesota, Justice Kennedy’s concurrence in the 2015 Kerry case specifically said that courts can consider the executive branch’s motives if there is sufficient evidence the government acted in bad faith. The states, as you know, contend the Trump administration policy, which bars entry from seven Muslim-majority countries, is a de facto ban on Muslims, in violation of the First Amendment’s Establishment Clause.

What is the proper standard for evaluating a sweeping immigration order that categorically bars all travelers from seven countries, albeit temporarily? Like so much else about the Trump administration, that’s hard to predict.