If President Trump has one signature issue, it’s immigration. Or, more specifically, the fear of immigrants. While previous presidents from both parties have, at times, struggled to arrive at the best immigration policy, to one degree or another they all acknowledged that the immigrant story is the American story — one of risk-taking, struggle, work, hope and creating a better life for the next generation. Trump, however, sees immigrants only as a source of crime, economic threats and cultural displacement. And, critically, this is both what he sincerely believes and what he thinks is the most effective political tool available to him.

So it was no surprise that, as the midterm elections approached, he would attempt to make them about immigration and the threat it supposedly poses. Now that the final votes are being tallied, it is becoming clear that not only did he fail, he made his party’s situation far worse than it might have been. His strategy backfired.

Most obviously, Trump’s campaigning on immigration didn’t stop Democrats from taking back control of the House, flipping seven governorships from Republican to Democrat, taking control of state legislatures, and passing progressive initiatives on issues such as Medicaid expansion, voting rights and the minimum wage. In Congress, where Trump focused most of his attention, Democrats faced a brutal map in the Senate but lost a net of only two seats (one, if Sen. Bill Nelson pulls ahead in a Florida recount). In the House, it looks as though they’ll pick up 38 seats, their biggest gain since the post-Watergate election in 1974.

If that were all we knew, Trump might be able to argue that focusing on immigration was still a good tactic and, without it, things could have been even worse for Republicans. But that doesn’t appear to be the case. Instead, his relentless fearmongering seems to have produced a backlash.

Take, for instance, this poll conducted for the progressive group Immigration Hub:

According to Nick Gourevitch, Partner at Global Strategy Group, “New polling we conducted in the immediate aftermath of the election shows that Trump’s anti-immigrant focus backfired with voters in Pennsylvania and Colorado. Voters found that Republican candidate alignment with Trump on immigration was more of a reason to vote against those candidates than to vote for them, including with politically important groups like Independents in Colorado and voters in Pennsylvania who voted for Trump in 2016 and shifted to Bob Casey in 2018.”

Every race is different, of course, but we saw in many districts and states that Republican candidates either embraced Trump’s xenophobic arguments and lost, or awkwardly tried to distance themselves from the president. Meanwhile, they got hammered on the party’s efforts to repeal the Affordable Care Act and remove protections for people with preexisting conditions — a threat that voters obviously saw as far more urgent than a bunch of families trudging across Mexico to request asylum. Some Republicans were warning before Election Day that Trump’s demagoguery would cost them seats; they turned out to be right.

This failure happened despite the fact that Trump got exactly what he wanted from the news media. When he began saying that we were under dire threat from an “invasion” of migrants walking toward the United States, despite the fact that their caravan was 1,000 miles away from the border, the news media immediately pushed the issue as though it were an immediate crisis. It was all-caravan-all-the-time on Fox News leading up to Election Day, but other networks focused on it as well, as did newspapers, repeatedly running stories about the caravan on their front pages.

Many critics are now describing this as an abysmal failure of the media, particularly now that everyone has simply stopped talking about the caravan, as we knew they would once the election was over. It is a difficult question: How much do you allow the president to determine your coverage? After all, he’s the president, and what he does is inherently newsworthy. They don’t call it the bully pulpit for nothing. But if you simply repeat everything he says, you’ve become a tool of his propaganda. This problem is far more acute when the president is a lying demagogue, so the answer most new organizations arrive at is that we’ll cover the issue, but we’ll do it with enough thoroughness and skepticism to counter whatever dishonesty with which it’s being served up.

The trouble with that, however, is that there are times when even the most skeptical coverage can still serve the demagogue’s goals. Just having stories and photos of the caravan on the front page every day could well have been all the president wanted, even if in the text of the story one could read about how it was actually weeks away, smaller than Trump claimed, and not actually full of gang members and terrorists. Half the battle in public debate is determining what gets defined as a problem that requires action to address, even if you still have to convince everyone that your solution is the better one.

But if you think the media failed in its handling of the issue, it’s even more notable that, despite getting the coverage he wanted, Trump got the result he didn’t. His voters didn’t flock to the polls in numbers sufficient to beat back the blue wave. Suburban voters, likely turned off by him, handed Democrats one victory after another.

There are many reasons the immigration issue didn’t work to Trump’s advantage this year the way it did in 2016. But we’ll get another test in 2020. When he runs for reelection, Trump will try once again to use hate and fear of immigrants to pull himself to victory. We can say that with confidence because, despite his party’s midterm losses, there’s no reason to think he has changed his views about what his base wants and what works for him — not to mention what he truly believes is best for the country.

If Trump has any bit of political genius, it’s his ability to locate the worst in people — their fear, their envy, their resentments, their hatred — and stimulate it with a poisonous kind of adrenaline. This time, though, most voters recoiled in disgust at what he was doing. We’ll see whether it happens again in two years.

Read more: