By Lawrence Hurley

WASHINGTON (Reuters) - Justice Anthony Kennedy's legal reasoning in a little-noticed 2015 U.S. Supreme Court immigration ruling could play a pivotal role in deciding the fate of President Donald Trump's travel ban if the high court eventually decides the matter.

The 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.

On its face, the ruling would seem to help the administration in its defense of the president's Jan. 27 executive order, which temporarily barred entry into the United States by people from seven Muslim-majority nations and put on hold the entry of refugees. Lower courts have blocked the order, but the administration may ask the Supreme Court to revive it.

But in a concurring opinion in the 2015 case, Kennedy wrote that in some circumstances the U.S. government's motives in denying someone entry could be subject to legal review. That reasoning was cited by the states of Washington and Minnesota in their lawsuit seeking to overturn Trump's ban.

Kennedy is a conservative justice who sometimes joins the court's four liberals and often casts the deciding vote in close cases.

The states argued that the executive 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."

Related Video:

For more news videos visit Yahoo View, available now on iOS and Android.

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 the government had not given a legitimate reason for denying the visa.

Story continues

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 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, which could appeal to the Supreme Court as early as Friday, 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. The case could reach the high court again at a later date.

The Supreme Court is ideologically split, with four conservative justices and four liberals. 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 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.

(Reporting by Lawrence Hurley; Editing by Sue Horton and Will Dunham)