Richard Ellis/Getty

Ted Cruz is humiliating himself because he thinks it will help him become president some day.

Two months ago, Cruz got revenge on Trump in Cleveland. But on Friday, he reversed course and, in a humiliating 700 word Facebook post, endorsed the man who called his wife ugly, said his dad was involved in the Kennedy assassination, and (probably) planted an adultery allegation in The National Enquirer. Why did Cruz reverse course?

Cruz wants to be president. He originally told Trump to get bent in Cleveland because he thought that would pay off in 2020: In mid-July, a Clinton landslide was very much in the realm of possibility and many conservative GOP donors were not interested in backing Trump. Cruz was making a long-term bet that the Republican candidate for president would lose for the third straight time and that Republicans would blame Trump—and Trumpism—for their defeat. Cruz, one of the few who stood tall, could stride in as the man who got it right, the one true conservative, Ronald Reagan’s heir.

A lot has changed since July. First, Cruz pissed off a lot of donors by going after Trump. That, in the short-term, shouldn’t matter much—Cruz isn’t up for reelection until 2018. But recently a Republican challenger has popped up: Rep. Michael McCaul. McCaul is very much an establishment Republican, but he still represents a threat to Cruz, even if Trump wins. (If Clinton wins, Cruz could also expect a challenger from the Atilla the Hun wing of the party.) By endorsing Trump—at the risk of making a fool of himself—Cruz is trying to head off any claim that he was insufficiently supportive of Trump that could hurt him in 2018, while making good with GOP donors, who he’ll need. Second, the race is closer now than it was. Trump could win! Cruz’s entire bet was made on the premise that a Trump loss was more or less inevitable. That’s not true anymore, so Cruz is hedging.

The ultimate goal, however, has not changed. Everything Ted Cruz does he does to one day become president. But losing his Senate seat does not help Cruz become president and neither does pissing off President Donald Trump. The terrain has changed, so Cruz has changed with it. And it probably wasn’t a very hard decision for him to make. Cruz’s anti-Trump stand was never about principle, it was about becoming president. Cruz’s humiliating endorsement about Trump is about making good with donors and keeping his Senate seat... so he can become president.