|By Dan Levine

SAN FRANCISCO (Reuters) - The most consequential legal challenge to U.S. President Donald Trump's travel ban will proceed on two tracks in the next few days: in a U.S. appeals court vote in San Francisco and the Seattle courtroom of a federal judge.

The 9th U.S. Circuit Court of Appeals will vote on whether to reconsider an appeal in the case that was decided in the Seattle court last week. That vote could reveal which judges disagree with their colleagues on the bench and support the arguments behind the new president's most controversial executive order.

In Seattle, the state of Washington will attempt to probe Trump's motive in drafting the Jan. 27 order.

In another case, in Virginia, a federal judge on late Monday halted enforcement of portions of the order against Virginia visa holders or permanent residents, concluding that the travel ban likely violates the U.S. Constitution’s protections for freedom of religion.

The rulings put the order on hold until the courts can rule on the underlying merits. Ultimately, they will have to address questions about the extent of the president's power on matters of immigration and national security. Traditionally, judges have been extremely cautious about stepping on the executive branch’s authority in such matters, legal experts say.

Trump's directive, which he said was necessary to protect the United States from attacks by Islamist militants, barred people from Iran, Iraq, Libya, Somalia, Sudan, Syria and Yemen from entering the country for 90 days. Refugees were banned for 120 days, except those from Syria, who were banned indefinitely.

The ban was backed by around half of Americans, according to a Reuters/Ipsos poll, but triggered protests across the country and caused chaos at some U.S. and overseas airports.

U.S. District Judge James Robart in Seattle suspended the order nationwide after Washington state challenged its legality, eliciting a barrage of angry Twitter messages from Trump against the judge and the court system. A three-judge panel at the 9th U.S. Circuit Court of Appeals in San Francisco upheld the ruling last week, raising questions about Trump's next step.

In the Virginia case, U.S. District Judge Leonie Brinkema said there was a lack of evidence showing a national security purpose for the executive order and issued a preliminary injunction against parts of it.

While the ruling is not on the underlying merits of the case, Brinkema noted, “The ‘Muslim ban’ was a centerpiece of the president’s campaign for months.”

Legal experts said no other judge has so fully considered the question of whether the order amounted to a discriminatory ban on Muslims. According to Brinkema, "the evidence indicates the government’s purpose was based on religion,” said Nelson Tebbe, a professor at Brooklyn Law School, adding that the ruling could influence other judges’ views on the matter.

At a Seattle court hearing on Monday, Robart said he would move forward with discovery in the case, meaning the request and exchange of information pertinent to the case between the opposing parties.

Meanwhile, an unidentified judge on the 9th Circuit last week requested that the court's 25 full-time judges vote on whether the temporary restraining order Robart imposed on Trump's travel ban should be reconsidered by an 11-judge panel, known as en banc review. The 9th Circuit asked both sides to file briefs by Thursday.

Since judges appointed by Democrats hold an 18-7 edge on the 9th Circuit, legal experts say it is unlikely a majority will disagree with the court's earlier ruling and want it reconsidered.

Arthur Hellman, a professor at the University of Pittsburgh School of Law who has studied the 9th Circuit, noted that one of the three judges who issued the original ruling was appointed by President George W. Bush.

Even if the en banc vote fails, however, judges on the 9th Circuit who disagree with last week's ruling will be able to publicly express their disagreement in court filings, which could help create a record bolstering Trump's position.

Meanwhile, the government has signaled that it is considering issuing a new executive order to replace the original one. In that case, it could tell the 9th Circuit later this week that it does not want en banc review, because the case would be moot.

"You would think Jeff Sessions would do whatever he had to do to get this case ended as soon as possible," Hellman said, referring to the recently appointed U.S. attorney general.

(Reporting by Dan Levine in San Francisoc. Additional reporting by Andrew Chung in New York; Editing by Noeleen Walder and Jonathan Oatis)