DALLAS—The morning after his second and final Senate debate with Rep. Beto O’Rourke, Ted Cruz was happy to see me. Late the night before, I had published an assessment of the debate, crediting Cruz with getting the job done but also mocking his over-the-top, fearmongering portrayal of Texas under Democratic control, delivered in that famously smug voice that’s riled up millions—not all of them Democrats—for the past five years.

Cruz said he liked the piece.

“I probably shouldn’t say that,” he added. “I should say I hated it.”

But he didn’t hate it. And I bet I know why: For all the contempt directed at the Texas senator and the now baked-in assumption that he’s an insufferable jerk, Cruz knows that his smarmy, dripping calculation, so off-putting to his enemies, is his greatest strength as a politician.

Ted Cruz is on track to win his re-election on Nov. 6. Despite the national frenzy surrounding his opponent—an inspirational figure whose campaign is more like a movement—Cruz is leading the race comfortably, by about 5 to 10 percentage points on average. And cutting against the narrative, put forward even by some of his close friends, that he has a “likability” problem relative to the charming O’Rourke, he now has a higher favorability rating in Texas than the “congressman from El Paso,” as Cruz refers to O’Rourke in a way that sounds, somehow, like an insult.

You can imagine a world in which the Republican candidate running against Beto O’Rourke would feel overwhelmed by the sheer force of the energy on the opposite side. That’s not Ted Cruz. He’s created his advantage ruthlessly, defining the previously little-known O’Rourke as too liberal for what’s still a red state. It’s the only message he has time for, and he does not stray. Even when the polls were closer, even when he appeared to be in trouble, even when a normal candidate would have felt a little distraught about being portrayed as a pathological demon to O’Rourke’s authentic angel. Some candidates allow themselves, fatally, to answer questions directly, while others only stay on message begrudgingly, perhaps after having touched the hot stove a time or two before. Cruz is the only politician I’ve seen who appears to enjoy the act of staying on message as one of politics’, or life’s, grand pleasures.

When Cruz complimented my debate write-up, it was just before his press conference at the San Antonio Police Officers Association, where he had been participating in a roundtable. “Last night’s debate,” he said to the press, “presented a stark contrast. It is night and day. Every Texan can see the choice in this election. Congressman O’Rourke made clear he’s for higher taxes. I’m for lower taxes. Congressman O’Rourke made clear he’s for more job-killing regulations, especially pounding oil and gas and Texas energy. I’m for lower regulations. I want to see the energy industry and the Texas economy continue to boom.” He went on like this for a while, on every issue. It was deeply boring. But as Cruz knows, the candidate’s primary role in a campaign, outside of fundraising, is a single, repetitive routine: getting talking points aired on local television and radio stations.

My fascination with Cruz’s unbreakable discipline began when I followed him around New Hampshire during the 2016 presidential primaries. Not a single word, syllable, inflection, or chuckle would change between stump speeches. If a new syllable did enter the 20-minute speech, it wouldn’t be because he decided to riff, or loosen up, or just got too tired to keep it together. It would be because his data showed there were X number of voters in a particular county or town who put special emphasis on a particular issue. He does not say things that he has not calculated the pros and cons of saying. And he cannot be broken. Ask senators like Wisconsin’s Ron Johnson or Tennessee’s Bob Corker the same question three or four times, and they will eventually say something. Not Cruz.

At the San Antonio press conference, one reporter tried to ask about Cruz’s relationship with Donald Trump. “The president has previously insulted your wife, he said that you’ve done nothing for Texas,” the reporter said. “Do you view him as a reliable advocate for you in this race?”

“Well, listen.” Cruz responded, in his trademark condescending tone. “I appreciate the media wanting to focus on political attacks from a campaign that was two years ago. I’m focused on the people of Texas. I’m focused on what we’re accomplishing for the people of Texas. Texas is booming. We’re seeing an economic boom that is incredible for the state of Texas, with a …” And on and on.

Cruz’s relationship with Trump during the 2016 presidential primaries was the one moment that made me question whether he could not be calculated, and whether he, like a mere mortal, might be prone to allowing his anger to briefly cloud his political judgment.

For a while after he’d dropped out of the primaries, Cruz seemed to have trouble shaking a genuine loathing for Trump. It ran deep enough that, months later, he would put his career on the line during the GOP convention, refusing to endorse the president in his keynote speech on the convention’s penultimate night. Why? The morning after that speech, he would tell the irate Texas delegation that Trump’s tweet mocking the looks of his wife, Heidi, months earlier was behind his non-endorsement.

Did Ted Cruz really allow a personal wound to define his political decision-making, this one time?

Maybe not. A recent profile of Heidi Cruz in the Atlantic offers a much different reaction to the tweet than the one the Cruzes offered publicly. “These things don’t bother Ted,” Heidi told the Atlantic. “He’s not saying, ‘Oh, I feel so bad; they think my wife’s ugly. You’re so pretty, Heidi. You’re not ugly.’ ” Instead, she said of her husband’s reaction to Trump, “He’s like, ‘Hah! That was the worst move he’s ever made.’ ”

If Cruz was, in fact, gleeful that the president made fun of his wife, that returns us to the common thread of any move Cruz makes: that rejecting Trump was a calculation. It does not seem crazy to think that Cruz believed Trump would lose the general election, badly, to Hillary Clinton, and that the senator who refused to endorse him on the convention floor would stand out brightly during the de-Trumpification of the party, putting himself on course for the 2020 presidential nomination. It was a rare bad bet Cruz has made in his political career. His numbers among Republican voters in Texas collapsed, endangering his 2018 re-election bid. He sold off his position and endorsed Trump in September. On Monday, Trump and Cruz will appear together at a MAGA rally in Houston.

Two days after the debate and one day after meeting with the San Antonio Police Association, Cruz was in Dallas, meeting with the Dallas Police Association. There, I asked him to speak about how he and Trump were able to reconcile after the fireworks of 2016. He started nodding halfway through the question, and saying, “Sure,” as he does, before recording a nonanswer for the local television affiliates about how exciting it was to see to see the president visit the state.

Eventually I followed up, asking, specifically, how he and Trump had buried the hatchet. He gave something in the ballpark of an answer.

“It’s very simple. When President Trump was elected, in November of 2016, I got on a plane. I flew to New York the next week to Trump Tower. And I sat down with the president, I sat down with his senior team. Spent 4½ hours there. And I told him, I said, ‘Mr. President, this is an historic opportunity. It is rare. History teaches that it is rare to see a Republican White House, Republican majorities in both houses of Congress. It’s happened four times in the last 100 years. We can’t waste this opportunity.’ ”

Cruz and Trump may have completely different political styles, each annoying to their antagonists in their own way, but there is one move they share in common. The personal rapport they may enjoy with individual journalists disappears the moment they move to a setting where it’s political advantageous to trash “the media” under questionable pretenses.

So it was last Friday, at the Fort Worth stockyards, where Cruz was holding a rally.

“We’ve got some journalists here,” Cruz said, looking directly at the press pen, where there were only a few of us. “There used to be something called reporting of facts,” he continued, making his case that the media has not been fair to him over a tax issue. (If the media is saying that he’s been misleading, then the media has been fair.)

“Facts matter,” he said to uproarious cheers. “And even when the media are being little puppy dogs that repeat what you say, you don’t get to just make up facts.”

Then, just like Trump, Cruz transitioned from self-assured media criticism to a call for his audience to own the libs on Election Day.

“How many of you are familiar with Hippie Hollow? Hippie Hollow is the nude beach on Lake Travis,” he said, talking about a lake near Austin. “But on Election Day, I’m going to make a prediction right now, that Hippie Hollow will be empty, as every leftist in Austin is down at the polls voting. So we need Tarrant County to counterbalance that to keep Texas red.” (“By the way,” he observed, “have you ever noticed at a nude beach, the wrong people always show up?”)

If the polling is correct, Cruz will defeat the denizens of Hippie Hollow and earn his second term. Democrats in Texas and—perhaps even more so—nationally will be crushed, bewildered that the state with the handsome young guy on a skateboard could possibly re-elect such a nauseating, calculating, lyin’, amoral phony. Cruz will soak it up, knowing that he triumphed because of those traits—that what his detractors see as a giant, festering liability is how he wins.