Kevin Lamarque / Reuters

One common knock on President Donald Trump is that he is chronically dishonest. Another is that he is a fickle leader who cannot or will not focus on any particular topic for any extended period of time.

Both are true. But when it comes to border security, neither of these critiques really applies. Trump’s announcement of escalating tariffs on all goods from Mexico until illegal immigration stops is a desperate move. The sources of that desperation, though, are his determination to keep his promise to secure the border and the fact that despite trying constantly to make good on his vow, more than two years into his presidency, he still can’t figure out how.

Trump, as I’ve noted, has been remarkably consistent on border security, going back to his June 2015 campaign announcement, which prefigured the current situation: More Mexicans are now leaving the United States than entering, but people continue to stream north from farther south.

“It’s coming from more than Mexico,” Trump said. “It’s coming from all over South and Latin America, and it’s coming probably—probably—from the Middle East. But we don’t know. Because we have no protection and we have no competence, we don’t know what’s happening. And it’s got to stop, and it’s got to stop fast.”

The solution, Trump said, was simple. All it would take was a little common sense, and getting the right person in place. If only there were a president who was willing to be tough on immigration and implement the obvious policies, illegal immigration could be stopped. For more than two years since becoming president, Trump has tried to prove that he was right. He has instituted a long string of policy ideas that he thinks will prevent migrants from entering the United States, and each has—for its own reasons—failed.

The first big idea was one that Trump unveiled in that campaign launch. “I would build a great wall, and nobody builds walls better than me, believe me. And I’ll build them very inexpensively. I will build a great, great wall on our southern border,” he said. “And I will have Mexico pay for that wall.”

Predictably, Mexico did not agree to pay for the wall. Trump then said he’d try to force it to do so through a remittance tax, taking a cut of all money that Mexicans in the United States sent back home, but he eventually stopped talking about that—it was unclear that it would raise enough money, or that it would be workable or legal. Having effectively conceded that Mexico wouldn’t pay for the wall, Trump then tried to get Congress to do so.

Nearly as predictably, Congress did not agree to pay for the wall either. When Republicans controlled both houses of Congress, GOP leaders were reluctant to cough up the cash. Trump, for reasons that remain unclear, decided not to push them on it. Then came the 2018 midterms and the Democratic takeover of the House. He decided to get tough only then, forcing a government shutdown for more than a month, from December 2018 to January 2019.

Trump eventually blinked. Then he announced plans to pay for wall construction by reprogramming already allocated funds under a national-emergency declaration. While some of those moves seem straightforward, others are of questionable legality and tied up in litigation. And even if Trump were to succeed in court, these measures would pay for only a small portion of the wall. Ultimately, he will need Congress.

With wall construction on ice, Trump has tried a variety of other measures to stem the flow of migrants across the southern border. He dispatched thousands of troops to the border, but under the U.S. laws the president invoked, the military can’t enforce immigration laws, so instead service members went to the border, assisted with some construction, and then sat around bored and hot for a few weeks before being withdrawn.

The law has, in fact, proved a powerful constraint on Trump’s border plans. The administration infamously decided to separate children from parents arriving at the border, but was pounded by both public opinion and the courts; meanwhile, there’s little evidence that the move had the intended deterrent effect. Trump has attempted to reshape asylum laws in a variety of ways, though those efforts, too, have been caught up in court, since the president can’t unilaterally change asylum laws passed by Congress. Trump reportedly told border agents to block asylum seekers, contrary to the law, and promised that if they were prosecuted, he would pardon them. (No one seems to have followed this advice.) Trump has also threatened to close crossings, but has been talked out of it by aides.

Now comes Trump’s latest move, the 5 percent tariff, which could rise over time if Mexico doesn’t comply. It’s a more modest version of an earlier threat to levy a 25 percent tariff on all Mexican goods, but it has still created chaos. U.S. companies are scrambling to figure out how to deal with the tariff, Republican lawmakers are critical, and Mexico is responding with anger and defiance.

The revolving door of policy ideas, many of them obviously flawed, betrays Trump’s frantic desire to follow through on his immigration rhetoric. But the issue is not as straightforward as he promised on the campaign trail. He told the nation that securing the border would be simple, but he was ignorant of both the challenges at the border and the legal constraints any president would face in achieving that goal. He has discovered too late that immigration is actually a challenging problem. He insisted that all that was needed was a president committed to solving the situation, but he has discovered that the president of the United States doesn’t have the unilateral power he imagined. He has hired and fired new border officials—he has now nominated his third secretary of homeland security, and has replaced a long list of lower-ranking officers—but that hasn’t solved the situation either.

There is the chance that the tariff (or some other trick) will actually succeed, but the prospects seem dim. Agreeing to Trump’s demands would likely be politically untenable for Mexican President Andrés Manuel López Obrador. Even if it were not, it’s unclear how much ability López Obrador has to stop illegal immigration through Mexico. After all, the American experience shows that border security is not so easy—especially without resorting to violence or inhumane tactics. It’s not even clear what would count as success in Trump’s view; his declaration says that Mexico must “dramatically reduce or eliminate the number of illegal aliens crossing its territory into the United States,” without naming quantitative targets.

There are, in fact, probably ways to secure the border, but they are not simple or obvious. Instead of Trump issuing ultimatums to Congress or Mexico, they would require him to negotiate. He could attempt to pass a comprehensive immigration bill through Congress that would overhaul the system while also getting him money for a border wall. (Senate Minority Leader Chuck Schumer has floated such a deal before.) Or Trump could work out a deal with López Obrador.

But Trump would have to give something up to get what he wants. He tends to see every discussion as zero-sum, and he is a terrible negotiator. Instead, Trump continues to search for a simple, magical solution that will allow him to keep his promise—even with none in sight.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.