President Trump speaks during a meeting with Republican lawmakers in the Cabinet Room of the White House on Tuesday (Jabin Botsford/The Washington Post)

President Trump’s victory Tuesday in the Supreme Court’s ratification of his travel ban marked a milestone in his attempt to paint broad swaths of immigrants as dangerous — a rhetorical strategy that has underpinned the administration’s sweeping efforts to unilaterally curtail immigration.

Since taking office 18 months ago, Trump has amplified, and attempted to codify into policy, his campaign-trail warnings of the threats posed by foreigners who attempt to enter the United States, including those who come through legal channels.

Shunting aside a Congress mired in a decades-long stalemate over immigration, the president has wielded his executive authority to pursue a hard-line agenda. The Trump administration has ramped up arrests of illegal immigrants, slashed refu­gee programs, criminalized unauthorized border crossings, attempted to terminate a deferred-action program for immigrants who came as children and — until Trump reversed himself last week — implemented a policy that separated families at the border between the United States and Mexico.

Critics expressed fears that the court’s ruling would embolden Trump to further test the limits of his statutory authority to enforce border-control laws without explicit approval from lawmakers. Aides have promised new measures ahead of the midterm elections in November, and Trump ruminated this week about the power to turn away unauthorized immigrants without offering them due-process rights.

“Who’s going to be next?” asked Sen. Mazie Hirono (D-Hawaii), whose state brought the case against the travel ban. “Is the president going to issue an executive order against Mexicans? Is he going to issue an executive order against people from Honduras? Guatemala? What’s next?”

The ban, which originally applied to six majority-Muslim nations, represented the audacity of Trump’s ambition in the early days of his administration — but also, over the past year, the potential legal limits of his authority. The administration suffered several humiliating legal setbacks in lower courts to immigrant rights groups that had cast Trump’s order as a xenophobic attack on Muslims that violated the Constitution.

The high court’s 5-to-4 decision, sharply split between conservative and liberal justices, handed Trump a “tremendous victory,” as he called it during impromptu remarks at the White House. Aides described an air of vindication and even elation in the West Wing just days after Trump acceded to an about-face over his family separation policy in the face of an international uproar.

“This ruling is also a moment of profound vindication following months of hysterical commentary from the media and Democratic politicians who refuse to do what it takes to secure our border and our country,” Trump said in a statement. “As long as I am President, I will defend the sovereignty, safety, and security of the American People.”

But Trump’s critics agreed with Justice Sonia Sotomayor, who in her dissent compared the ruling to the high court’s 1944 endorsement of the U.S. government’s imprisonment of Japanese Americans and Japanese citizens in internment camps during World War II.

The court’s opinion on the travel ban, though, included a repudiation of the earlier decision, which it called “gravely wrong the day it was decided.”

The travel-ban ruling is “a shameful mark on American history,” said Mariko Hirose, litigation director at the International Refugee Assistance Project, which successfully blocked an earlier version of the ban last year.

“If they are allowed to have this ban, what will they try next?” asked Mohamad Mashta, a Syrian immigrant who was a plaintiff in that case.

Over the past decade, as a politically polarized Congress failed in several attempts to pass major immigration bills, successive administrations have sought to unilaterally amend the laws through executive power. First under President Barack Obama, and now Trump, the immigration fight increasingly shifted from Capitol Hill to the judicial branch.

Obama sought to cast the majority of immigrants, even those in the country illegally, as law-abiding and productive members of society whose presence helped spur economic growth and added to the nation’s cultural vibrancy. He implemented the Deferred Action for Childhood Arrivals program that protected nearly 800,000 younger immigrants known as “dreamers” from deportation.

But his effort to expand the program to cover millions of parents of U.S. citizens was blocked when a deadlocked Supreme Court in 2016 failed to overturn a lower court’s injunction on the program.

Trump’s election turned the immigration fight on its head. In his first week in office, Trump signed an initial iteration of the travel ban during a visit to the Pentagon to swear in Defense Secretary Jim Mattis, a symbolic setting aimed at casting the order as an “extreme vetting” measure to combat “radical Islamic terrorists.”

“We don’t want them here,” he said. “We want to ensure that we are not admitting into our country the very threats our soldiers are fighting overseas.”

Trump also declared that priority for immigration visas be granted to Christians and other religious groups over Muslims.

Opponents cited a long history of presidential statements and tweets to challenge the order on the grounds that the ban was not based on legitimate national security concerns but rather constituted bigoted intolerance of Muslims.

In his bid to curb immigration, Trump has routinely used inflammatory rhetoric to fan false claims, refuted by statistical evidence to the contrary, that immigrants commit higher rates of crimes than native-born Americans.

In recent months, frustrated by a lack of progress on his proposed border wall, Trump has called immigrants “vermin” that are overrunning the country, although arrests of unauthorized border-crossers remain historically low. He has also accused Democrats of supporting “open borders” and of facilitating the brutality of MS-13, a transnational gang with many members born in the United States.

Last week, after reversing himself on the family-separation policy, Trump appeared at the White House with families whose relatives have been killed by immigrants living in the country illegally.

Immigrant rights advocates said the travel-ban ruling is bound to fortify Trump’s conviction to accelerate the administration’s efforts to choke off legal avenues for refugees, foreign students and temporary workers, all of whom have been confronted with new hurdles for entry.

“If you can issue an outright ban, there’s no end to what you can accomplish,” said Leon Fresco, an immigration attorney who served as an aide to Senate Minority Leader Charles E. Schumer (D-N.Y.) during the unsuccessful effort to pass a comprehensive immigration bill in 2013 and 2014. “You can turn it on any country at any time for any reason.”

Fresco said Trump’s immigration strategy over 18 months had produced “a dramatic turnaround in what it means to come to the U.S. both legally and illegally. Everything is longer, more difficult and much more stressful for every person interacting with the immigration system.”

Opponents vowed to continue to fight Trump in the courts. Omar Jadwat, an immigrant advocate at the American Civil Liberties Union, emphasized that nothing in the travel-ban ruling validated other immigration measures that are in litigation. That includes a legal injunction that has prevented Trump from unilaterally ending the Obama-era deferred-action program, a case that could reach the Supreme Court in the fall.

“The court got it wrong here, but that does not mean the court should or will get it wrong in other contexts,” Jadwat said.

Supporters of Trump’s immigration policies acknowledged that the legal battles have slowed his agenda and made progress more incremental than the president promised on the campaign trail. Roy Beck, president of NumbersUSA, said he recognized the strategy of advocates to try to delay Trump in court as a tactic his group has used to defeat “amnesty” proposals for undocumented immigrants.

“But today is maybe emblematic of what’s coming down the line,” Beck said of the travel-ban ruling. “We may be able to expect to see more actually happening.”

Mark Krikorian, executive director of the Center for Immigration Studies, which advocates for reducing immigration, said Trump is likely to feel empowered even if it took more than a year, and several iterations of the travel ban, to emerge victorious.

“Of course he does — why not?” Krikorian said. “The question is, how he will use it? What will he do?”

Philip Rucker contributed to this report.