WASHINGTON (Reuters) - Justice Anthony Kennedy’s legal reasoning in a 2015 immigration case suggests the U.S. Supreme Court’s frequent swing vote would be skeptical of President Donald Trump’s travel ban on people from seven Muslim-majority countries.

U.S. Supreme Court Associate Justice Anthony Kennedy arrives to attend the 64th Annual Red Mass at the Cathedral of St. Matthew the Apostle in Washington, U.S., October 2, 2016. REUTERS/Joshua Roberts

The little-noticed case involved an Afghan-born naturalized U.S. citizen named Fauzia Din who argued she had the right for a full explanation from the U.S. government as to why her Afghan husband was denied entry. The justices ruled 5-4 against her.

Kennedy wrote in a concurring opinion that in some circumstances the U.S. government’s motives in denying someone entry could be subject to legal review.

In their lawsuit challenging Trump’s Jan. 27 ban, the states of Washington and Minnesota cited Kennedy’s opinion. Lower courts have temporarily blocked the ban, but the administration may ask the Supreme Court to revive it.

Trump’s executive order barred entry for citizens from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen for 90 days and imposed a 120-day halt on all refugees, except refugees from Syria who are barred indefinitely.

Curbing entry to the United States as a national security measure was a central premise of Trump’s 2016 presidential campaign, originally proposed as a temporary ban on all Muslims. He has voiced frustration at the legal challenge to his order.

Washington and Minnesota argued that Trump’s order violated the U.S. Constitution by discriminating against Muslims. Trump during the presidential campaign called for a “total and complete shutdown of Muslims entering the United States.”

In the 2015 case, Din, who lives in Fremont, California, sued the U.S. government after her husband, Afghan citizen Kanishka Berashk, was denied a visa in 2009. She objected to the government’s visa denial under a law giving consular officials wide discretion to bar people linked to “terrorist activities.”

The high court’s ruling overturned a 9th U.S. Circuit Court of Appeals decision that said Din was right to insist the government give her more information about the visa denial.

Kennedy’s opinion suggested he could be willing to dig into the Trump administration’s rationale for the order, said Mark Haddad, the Los Angeles-based lawyer who represented Din in the 2015 case.

“The ostensible reason for the travel ban is security but that’s not a good faith concern if the underlying reason is religious animus,” Haddad said.

‘TOTAL DEFERENCE’

Kennedy’s opinion showed he is “not prepared to give complete and total deference to the executive branch in the enforcement of immigration laws,” Haddad added.

Samuel Alito, one of the court’s most conservative justices, signed onto Kennedy’s opinion. In total, six of the current eight justices suggested in that 2015 case that the government was not immune from scrutiny over immigration-related decisions if there was evidence of a questionable motive.

The case brought by Washington and Minnesota, or one of several similar disputes around the country, could reach the high court quickly in the wake of Thursday’s decision by a three-judge panel of the San Francisco-based 9th Circuit upholding a Seattle district judge’s decision to block Trump’s order.

The Trump administration would need to win the support of five of the current eight justices to reinstate the order while litigation over the legality of the directive continues. It could also seek to end the litigation by issuing a new order.

Neil Gorsuch, Trump’s nominee to fill a lingering vacancy, is awaiting Senate confirmation hearings and is unlikely to be seated on the court for at least two months.

The 2015 case, called Kerry v. Din, was cited both by the challenging states and the Trump administration in their court fight.

Washington state’s lawyers argued Kennedy’s opinion showed that courts must look at what motivated the government’s decision beyond the words that appear in the order itself. They cited the previous comments by Trump and others expressing a desire to keep Muslims from entering the United States.

The administration noted in court papers Kennedy also made it clear that the government is entitled to deference, especially on national security.

Anil Kalhan, an immigration law professor at Drexel University’s Kline School of Law in Philadelphia, said there are multiple ways of interpreting Kennedy’s opinion, which could muddy the waters.

Kennedy’s opinion “doesn’t necessarily mean he would reach the same conclusion” on Trump’s ban, Kalhan said.

In Tuesday’s 9th Circuit oral argument, administration lawyer August Flentje called the executive order “facially legitimate,” meaning there is no need for courts to inquire further into motive.

Judge Michelle Friedland immediately pounced: “Haven’t there been allegations here of bad faith?” She said Kennedy’s opinion in the Din case as well as a 1972 Supreme Court ruling in a case with similar themes “envision that’s something we should look at.”

The 1972 case involved professors objecting to the U.S. government’s decision not to allow a Marxist academic to speak at a Stanford University conference. The appeals court cited both cases in its Thursday ruling.