There is rarely much logic or long-term calculation in the behavior of President Donald Trump. His attention span is shorter than a day trader’s, and his reactions are usually driven by the crisis of the moment or whatever appeared on Fox & Friends that morning. Yet for the past month, Trump seems to have been fixated on a possible 2020 matchup with Beto O’Rourke.

In February, Trump wanted to stage a photo op to promote the supposed need for a border wall, and the 1,954-mile line dividing the United States from Mexico provided a wealth of possible spots. Trump picked El Paso, which appeared to make little rational sense: the city is one of the safest in the country, and its violent crime rate was plunging even before a barrier was built in 2009—only to tick up slightly after the fence was completed. Michael Glassner, the chief operating officer of Trump’s re-election campaign, nevertheless claimed to me that the site of the event was all about “the patriots who are on the frontlines of the struggle against open-border Democrats who allow drugs, crime, and sex trafficking all along our border every day.”

El Paso also just so happens to be the population center of the district O’Rourke represented for three terms in the House of Representatives. That wasn’t a coincidence, one of Trump’s 2016 campaign advisers told me, three days before the anti-immigration rally. “The president is trying to build a case for building a wall. Choosing El Paso as the location is a very savvy and strategic move—especially because of the fact that it’s Beto’s hometown,” Jason Miller said. “Beto . . . will be a much more formidable opponent than one of the recycled Democratic establishment candidates like Joe Biden or Elizabeth Warren or Bernie Sanders. And the Democrats have a real problem with American voters on the crisis on the southern border. Having a rally like this in the hometown of a potential Democratic nominee will put on center stage the fact that national Democrats have no idea how to answer this issue for the minds of Middle America and Trump voters. [Trump 2020 campaign manager] Brad Parscale, who I spoke with this morning, is very good at targeting and analysis and knowing where there are a lot of Trump voters.”

Plenty of national Democrats have plausible alternatives to a wall and to jailing immigrant children. Still, for Trump, playing to his xenophobic base is in his DNA. What won’t be clear for months is whether the El Paso rally turns out to be brilliant or a blunder: as my colleague Joe Hagan reports in April’s cover story, the event helped motivate O’Rourke to jump into the Democratic primary field. But in goading O’Rourke, Trump appears yet again to be operating more by instinct than any general-election math. He sees in the 46-year-old Texan a fellow creation of social media, a character who is being lifted more by voters’ hearts than minds, and someone who Trump believes isn’t tough enough to defeat the media master. The president taunts all his enemies, of course, but on the morning that O’Rourke made his candidacy official Trump wasted no time trying to get under his skin. Trump, an expert on sanity, told White House reporters that O’Rourke’s excited hand gestures during an appearance at an Iowa coffee shop suggested the Democrat might be crazy. Deputy press secretary Hogan Gidley snarkily corrected a Fox News anchor who asked what the president thought about “Beto” entering the race. “First of all, you pronounced it wrong—it’s ‘Robert Francis,’” Gidley said, invoking O’Rourke’s given name, which is not exactly an insult for a man whose looks and charm are regularly and favorably compared with those of Robert F. Kennedy.