HONOLULU/NEW YORK (Reuters) - A defiant President Donald Trump has pledged to appeal to the U.S. Supreme Court if necessary to fight for his revised travel ban, parts of which were halted by two different federal judges in recent days.

The legal path forward will be challenging, though, as lawsuits work their way through federal courts on opposite sides of the country, in Hawaii and Maryland. On Thursday, a federal judge in Washington state said he was also weighing a temporary restraining order.

The Justice Department’s first step would likely be filing an appeal in either or both of the cases it lost this week, an action likely to come within days. Justice Department spokeswoman Sarah Isgur Flores declined to comment on the administration’s intentions.

In granting a temporary restraining order against the ban challenged in a lawsuit brought by the state of Hawaii, U.S. District Judge Derrick Watson found on Wednesday that “a reasonable, objective observer ... would conclude that the executive order was issued with a purpose to disfavor a particular religion.”

Trump’s executive order would temporarily ban refugees as well as travelers from six predominantly Muslim countries. The president has said the ban is needed for national security.

Early on Thursday, U.S. District Judge Theodore Chuang issued a nationwide preliminary injunction in a case in Maryland brought by refugee resettlement agencies represented by the American Civil Liberties Union and the National Immigration Law Center.

Chuang ruled that the groups were likely to succeed in showing that the travel ban portion of the executive order was intended to be a ban on Muslims, and as a result, violates the U.S. Constitution’s religious freedom guarantee. He did not enjoin the refugee portion of the ban.

“To avoid sowing seeds of division in our nation, upholding this fundamental constitutional principle at the core of our nation’s identity plainly serves a significant public interest,” Chuang wrote in his ruling.

The court orders, while victories for the plaintiffs, are only an early step in litigation and the government could ultimately win its underlying case. Watson and Chuang were appointed to the bench by former Democratic President Barack Obama.

Trump, speaking after the Hawaii ruling at a rally in Nashville on Wednesday, called his revised executive order a “watered-down version” of his first.

The president said he would take the case “as far as it needs to go,” including to the Supreme Court, in order to get a ruling that the ban is legal.

The Trump administration won a small legal victory later on Thursday.

U.S. District Judge James Robart in Seattle, who last month blocked Trump’s first travel ban, ruled that the second travel ban was different enough from the first that he would not simply apply a preliminary injunction he issued against the first ban to the second one. He said he was weighing a request for a temporary restraining order on the new travel ban.

Slideshow ( 4 images )

The likely next stops if the administration decides to contest the two rulings that it lost this week would be the 4th and 9th U.S. circuit courts of appeal. Both may be frosty venues for Trump’s arguments, with majorities of the judges in each appointed by Democratic presidents.

Three judges on the 9th Circuit upheld Robart’s order last month on the first travel ban. Rather than appeal further, the administration withdrew the ban, promising to retool it in ways that would address the legal issues.

The Supreme Court is currently split between four conservative and four liberal justices, with no ninth justice since the death of Antonin Scalia more than a year ago.

Slideshow ( 4 images )

Trump’s nominee to fill the vacant Supreme Court seat, Neil Gorsuch, a 49-year-old conservative, is likely to be asked about the travel ban next week when he goes before the Senate Judiciary Committee for a confirmation hearing.

Republicans are hoping that the Senate votes to confirm Gorsuch for the court by mid-April, which would likely be too late for him to weigh in on an emergency appeal about the travel ban.

Trump signed the new ban on March 6 in a bid to overcome legal problems with his January executive order, which caused chaos at airports and sparked mass protests before Robart stopped its enforcement in February.

Watson’s order is only temporary until the broader arguments in the case can be heard. He set an expedited hearing schedule to determine if his ruling should be extended.