The U.S. 4th Circuit Court of Appeals ruled Thursday to keep largely in place a block on President Donald Trump's temporary travel ban for six Muslim-majority nations, saying that the ban "drips with religious intolerance, animus and discrimination," while Trump's administration has pledged to take the issue to the Supreme Court.

Citing the president's duty to protect the country from terrorism, Attorney General Jeff Sessions said Thursday that the Justice Department will ask the high court to review the case, although he offered no timetable.

The Supreme Court is almost certain to step into the case over the presidential executive order issued by Trump that seeks to temporarily cut off visas for people from Iran, Libya, Somalia, Sudan, Syria and Yemen. The justices almost always have the final say when a lower court strikes down a federal law or presidential action.

The case pits the president's significant authority over immigration against what the U.S. Court of Appeals for the 4th Circuit said was a policy that purported to be about national security but was intended to target Muslims.

Parties generally have 90 days to appeal to the Supreme Court, but if the administration waits until late August to ask the court to step in, the justices probably would not vote on whether to hear the case until October and arguments probably wouldn't take place until February 2018 at the earliest. That would be more than a year after Trump rolled out the first travel ban.

Administration lawyers could instead seek the justices' approval to put the travel policy in place on an emergency basis, even as the court weighs what to do with the larger dispute.

If that happens, the justices' vote on an emergency motion would signal whether the government is likely to win in the end. It takes a majority of the court, five votes, to put a hold on a lower court ruling. If at least five justices vote to let the travel ban take effect, there's a good chance they also would uphold the policy later on.

Thursday's ruling by the U.S. Court of Appeals for the 4th Circuit was a loss for the administration. The court ruled 10-3 that the ban likely violates the Constitution and upheld a lower court ruling blocking the Republican administration from enforcing the travel ban unveiled in March, a revised version of the policy first issued in January.

The Richmond, Virginia-based 4th Circuit is the first appeals court to rule on the revised ban. Trump's administration had hoped it would avoid the legal problems that the first version encountered. A second appeals court, the 9th U.S. Circuit based in San Francisco, is also weighing the revised travel ban after a federal judge in Hawaii blocked it.

A central question in the case is whether courts should consider Trump's public statements about wanting to bar Muslims from entering the country as evidence that the policy was primarily motivated by the religion.

Trump's administration argued the 4th Circuit should not look beyond the text of the executive order, which doesn't mention religion. The countries were not chosen because they are predominantly Muslim but because they present terrorism risks, the administration said.

But Chief Judge Roger L. Gregory wrote that the government's "asserted national security interest ... appears to be a post hoc, secondary justification for an executive action rooted in religious animus and intended to bar Muslims from this country."

The three dissenting judges, all appointed by Republican presidents, said the majority was wrong to look beyond the text of the order. Judge Paul V. Niemeyer wrote that Supreme Court precedent required the court to consider the order "on its face." Looked at that way, the executive order "is entirely without constitutional fault," he wrote.

Sessions said the court's ruling blocks Trump's "efforts to strengthen this country's national security."

Trump's first travel ban issued January 27 was aimed at seven countries and triggered chaos and protests across the U.S. as travelers were stopped from boarding international flights and detained at airports for hours. Trump tweaked the order after the U.S. Court of Appeals for the 9th Circuit refused to reinstate the ban.

The new version made it clear the 90-day ban covering those six countries doesn't apply to those who already have valid visas. It also got rid of language that would give priority to religious minorities and removed Iraq from the list of banned countries. Critics said the changes don't erase the legal problems with the ban.

Ilya Somin, a law professor at George Mason University, said it's difficult to make a confident prediction on what the Supreme Court will do with the case. If the Supreme Court follows a partisan divide, the Trump administration may fare better since five of the nine are Republican nominees. Still, he said, "Supreme Court justices don't always vote in ideological lockstep."