President Donald Trump has spent three years molding America’s immigration system to primarily be concerned with keeping people out.

He built, layer by layer, impediments in Central America, at the border, in detention centers, and in the immigration courts that have made obtaining asylum nearly impossible.

He swept aside former President Barack Obama’s immigration enforcement priorities in favor of vastly expanding immigration detention and prosecuting every immigrant who crosses the border without authorization. The result is a punitive system that treats immigrants as criminals and places them in prolonged detention even if they don’t pose any danger to the public.

And he waged a quiet and effective campaign to reduce legal immigration — including expanding his travel ban to block immigration from Nigeria, the largest country in Africa. Under Trump, the legal immigration system increasingly rewards skills and wealth over family ties to the US, while shutting out a growing number of people from low-income countries.

When Trump laid out the start of his reelection-year argument in the State of the Union address on Tuesday night, his guests included a senior Border Patrol official and the brother of a man who was killed by an unauthorized immigrant. His immigration record was one of his top talking points.

He painted immigrants as criminals that pose a danger to public safety (overall, they don’t) and railed against sanctuary cities that do not cooperate with federal immigration enforcement authorities. And he touted his policies clamping down on unauthorized border crossers.

“Before I came into office, if you showed up illegally on our southern border and were arrested, you were simply released and allowed into our country, never to be seen again,” Trump said. “My Administration has ended Catch-and-Release. If you come illegally, you will now be promptly removed.”

It’s true that Trump has run into some roadblocks: He’s behind schedule on construction of the southern border wall, a key messaging tool for his base. He hasn’t been able to appoint his preferred candidates to lead the immigration agencies. His attempts to pass immigration-related legislation in Congress have failed. And his policies have faced so much opposition in the courts that his administration has appeared to pursue a strategy of rapidly churning out new policies and hoping that at least some of them survive judicial review.

But while he might not have succeeded at building an actual wall to keep immigrants out, his policies have achieved the same end. Reducing overall immigration levels has long been on the wish list of once-fringe restrictionist groups like the Center for Immigration Studies, whose co-founder advocated for maintaining a European-American majority population. Trump is making it a reality.

Trump is shutting the door on asylum seekers at the border

Trump’s primary focus upon entering office was addressing the unprecedented number of children and families arriving at the southern border from Honduras, El Salvador, and Guatemala — collectively known as Central America’s Northern Triangle — where crime, violence, and lack of economic opportunity has driven hundreds of thousands to flee over the past two years.

The administration hasn’t addressed the root causes of that crisis, but it has effectively cut off migrants’ access to the US asylum system. His ability to do all this has even surprised Mark Krikorian, the executive director of the Center for Immigration Studies.

“I didn’t expect them to pull it off,” he said. (Krikorian and his group are still pushing Trump to go further in his second term; his strategies have “taken the edge off,” but migrants are still continuing to arrive in “unacceptably high” numbers, he argues.)

Trump has deputized Central American countries in his immigration enforcement efforts. Some 60,000 asylum seekers have been sent back to Mexico to wait for their immigration court hearings in the US under his “remain in Mexico” policy, officially known as the Migrant Protection Protocols (MPP). It has appeared to discourage migrants from attempting to cross the southern border but has exacerbated the humanitarian crisis in Mexico, where thousands are waiting for their court hearings in the US, many of them in dire need of humanitarian aid.

Some migrants are lucky to find housing in shelters, hotels, or rooms for rent, but for more than 5,000 others, only tents and tarps, some held up by only sticks and stones, stand between them and the elements, even as temperatures drop below freezing. As populations swell, both the US and Mexico have left thousands in the camps without basic necessities like clean drinking water and warm clothes — and at risk of extortion, kidnapping, and rape at the hands of cartels and other criminal actors.

Trump has also brokered a series of agreements with the Northern Triangle countries that require migrants to apply for protections in those countries first. If they fail to do so, US immigration authorities can send them back to those countries (though only the agreement with Guatemala is currently in effect). So far, 368 asylum seekers have been deported to Guatemala.

The agreements resemble “safe third-country agreements,” a rarely used diplomatic tool that requires migrants to seek asylum in the countries they pass through by deeming those countries capable of offering them protection (though the Trump administration has been reluctant to use that term). Until recently, the US had this kind of agreement with just one country: Canada.

These agreements were never meant to be a means to push the burden of absorbing asylum seekers onto other countries, but that appears to be the way Trump is trying to use them. Immigrant advocates say the costs could be deadly, since it means returning migrants to countries that have high levels of crime and instability, and that are not used to dealing with an influx of people seeking refuge.

In Mexico and the Northern Triangle countries, migrants are commonly robbed, kidnapped for ransom, raped, tortured, and killed. The State Department, meanwhile, has issued travel warnings for US citizens in all four countries.

El Salvador has the highest homicide rate in the world, while Honduras ranks fifth, Guatemala 16th, and Mexico 19th, according to the United Nations Office on Drugs and Crime. They have rampant government corruption and high rates of violence against women and LGBTQ individuals.

Trump’s changes to legal immigration

As much as Trump’s rhetoric focuses on clamping down on unauthorized immigration at the southern border, the president has also instituted new restrictions on legal immigration — many of which have survived Supreme Court review.

During his speech on Tuesday, Trump called for an immigration system that rewards immigrants who “contribute to our economy, support themselves financially, and uphold our values” — while keeping out low-income immigrants and nonwhites from what he once referred to as “shithole countries.” He’s already bringing that vision to life.

Heeding calls from 31 states to end refugee admissions from Syria, Trump has slashed the total number of refugees the US accepts annually to just 18,000 this year, the fewest in history and down from a cap of 110,000 just two years ago.

His so-called public charge rule essentially establishes a wealth test for immigrants seeking to enter the US, extend their visa, or convert their temporary immigration status into a green card. The rule gives immigration officials much more leeway to turn away those who are “likely to be a public charge” based on an evaluation of 20 factors, ranging from the use of certain public benefits programs — including food stamps, Section 8 housing vouchers, and Medicaid — to English language proficiency.

Julia Gelatt, a senior policy analyst at the Migration Policy Institute, a nonpartisan think tank, said that 69 percent of the roughly 5.5 million people who were granted green cards over the past five years had at least one negative factor under the rule, which officials could have used as justification to reject their applications for immigration benefits.

Trump is also cracking down on foreigners giving birth to children in the US who become, by birth, American citizens, particularly if they can’t prove they can pay for their medical treatment.

And he’s placed restrictions on citizens of many Muslim-majority and African countries. His travel ban prevents citizens of Iran, Libya, Somalia, Syria, Yemen, Venezuela, and North Korea from obtaining any kind of visa allowing them to enter the US. He recently added new restrictions on immigration from six additional countries — Myanmar, Eritrea, Kyrgyzstan, Nigeria, Sudan, and Tanzania — in what advocates are calling an “African ban” since about four in five of those affected are from African nations.

Trump has overcome court challenges to some of these policies: In four of the six cases in which the Supreme Court weighed in on Trump’s immigration policies, the court’s conservative majority has so far sided with the administration. Notably, the justices upheld his travel ban in June 2018, affirming his broad powers to restrict immigration to the US for national security reasons.

The justices have also allowed Trump to move forward with his immigration policy plans while lawsuits challenging them make their way through lower courts.

They gave the green light to Trump’s rule preventing migrants from applying for asylum if they passed through another country other than their own before arriving in the US. They also allowed him to divert $3.6 billion in military funds to construct the border wall and implement the public charge rule.

Most voters don’t identify with Trump’s anti-immigrant rhetoric

The way Trump talks about immigration in his State of the Union address is likely to preview what he says on the campaign trail.

That might appeal to the 42 percent of voters who support his immigration policies. But 57 percent of voters disapprove of Trump’s performance on immigration and 60 percent either oppose or strongly oppose the construction of the border wall, his signature immigration policy.

Not only are most voters against Trump’s immigration policies, but many also just don’t view it as a top priority — bread-and-butter issues like health care and the economy are what they care about most. Fifty-one percent of voters overall said that immigration should be a top priority, ranking below eight other policy issues. Republicans seem to care more about immigration, with 68 percent saying it should be a top priority compared to 40 percent of Democrats.

The share of Americans who support increasing immigration has also risen to 32 percent as of 2018, up from 10 percent in 2001.

“While Trump mobilizes his core supporters on the issue of immigration, he also mobilizes a backlash to his divisiveness and xenophobia,” Frank Sharry, the executive director of the immigrant advocacy group America’s Voice, said.

Democratic candidates have largely ignored the topic of immigration in the debates so far, but based on the immigration plans they’ve released, the entire field has moved to the left on immigration. All of the frontrunners would, for example, push for a pathway to citizenship for unauthorized immigrants living in the US and streamline the process of applying for asylum and other forms of legal immigration.

Their biggest challenge upon entering office, however, would be reversing Trump’s changes to the immigration system. Much of it they could accomplish unilaterally by executive action — they could end MPP and the travel ban and raise the cap on refugee admissions immediately, for example — but some of Trump’s changes are harder to reverse.

Repealing Trump-era immigration regulations would involve a protracted process of giving public notice and the opportunity to comment that often takes months. It may also take time to rebuild some of the institutions that deal with immigration. For example, Trump has presided over a brain drain of experienced staffers in the immigration courts and the State Department, which manages the refugee program and consulates abroad.

For as much as Democratic candidates claim they will reverse Trump’s policies, the president has left his mark on the immigration system. He has delivered for his base on that front — and he’s hoping it will be enough to carry him to victory again in 2020.