WASHINGTON — President Donald Trump's restriction on travel to the United States from a handful of mostly Muslim countries returns to the Supreme Court on Wednesday, facing better prospects than the previous versions that were largely rejected by the courts.

The case is a critical legal test for a pillar of Trump's immigration policy. And it marks the first time the court will give a full hearing to one of the president's initiatives.

The justices will decide whether this third try at a travel ban is legally acceptable — as the result of a deliberate process to identify high-risk countries whose nationals should largely be prevented from entering the country — or is merely a dressed up form of the Muslim ban promised during the Trump campaign.

Imposed last September by presidential proclamation, the latest version maintains limits on granting visas to travelers from five of the six countries covered by the original travel executive order — Iran, Libya, Somalia, Syria, and Yemen. It lifts restrictions on visitors from Sudan and adds new limits on those from North Korea and Venezuela. Chad was part of the proclamation, but it was removed April 10, after the White House said the country met enhanced visa security requirements.

The state of Hawaii, three of its residents and a Muslim-American group challenged the new restrictions, and a federal judge blocked enforcement. But the Supreme Court lifted that stay in December, and the government has been enforcing it in full since. Only Justices Ruth Bader Ginsburg and Sonia Sotomayor dissented, a sign that the administration may fare better with this version.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The Trump administration argues that this one is different because it was imposed only after the administration surveyed more than 200 countries for their effectiveness in providing information about the backgrounds of visa applicants and their success in fighting terrorism at home.

A central question in the case is how much power the president has to block the entry of millions of foreign nationals.

The Justice Department argues that the Constitution and federal laws give the president "broad authority to suspend or restrict the entry of aliens outside the United States when he deems it in the nation's interest." While immigration law doesn't require the president to spell out detailed findings before he invokes the authority, the government says, the September proclamation "is more detailed as a matter of both process and substance than any prior order" limiting travel.

Other presidents have used this power to ban travel by large classes of people, says Solicitor General Noel Francisco, such as President Ronald Reagan, who suspended entry by all Cuban nationals in retaliation for Cuba's suspension of an immigration agreement.

But the challengers say the law gives the president power to ban only foreign nationals who share some characteristic making them harmful to admit to the U.S. In this case, says Neal Katyal, representing Hawaii, "it bans the immigration of a sprawling group of 150 million who share nothing in common but nationality."

What's more, he says, the president can only suspend admission — that is, ban issuing visas — temporarily. The current ban, by contrast, is more or less permanent.

The challengers also say the travel ban is unconstitutional because it is based on religious animus, citing frequent promises from Donald Trump, as a candidate and as president, to ban Muslims from entering the U.S.

"Any reasonable observer who heard the president's campaign promises," Katyal says, "would see this as the fulfillment of the president's promise to prohibit Muslim immigration to the United States."

But the government says the proclamation's history and text are neutral with regard to religion. It was the result, the Justice Department says, of foreign policy and security decisions by several government agencies.

The first executive order on travel, announced Feb. 1, 2017, caused chaos at major airports when border officials refused to admit travelers who were in flight when the rules went into effect. It was quickly blocked by the courts. Enforcement of a revised travel ban, issued about a month later, was also stopped by lower court judges. The Supreme Court allowed it to be enforced except for visa applicants with family or other close U.S. connections, but it expired before it was to be the subject of a full blown Supreme Court review.

After the justices hear the case on Wednesday morning, a transcript and an audio recording of the courtroom argument will be posted by 2 p.m. ET on the court's website, www.supremecourt.gov.