Don't cry for Ted Cruz. The junior senator from Texas played his failed run for the White House perfectly.

All the evidence suggests that Cruz was genuinely in it to win the Republican nomination, dropping out only when it became mathematically impossible for him to become the nominee before the Republican National Convention and vanishingly difficult for him to wrest the nomination away from Donald Trump at the convention. He fought hard and executed a clever hug-Trump-until-the-end strategy. Surely, losing to the New York billionaire with shifting values, even among the Christian conservatives Cruz counted as his electoral rock, must have been hard and embarrassing.

But it was also a godsend. Losing to Trump saved Cruz from ruining his political career.

Barring a (not implausible) meltdown among Democrats or their almost certain nominee, Hillary Clinton, Cruz would have lost in November. He is, after all, to the right of Trump on just about every issue and lacks the charm or charisma or ideological flexibility to make his positions palatable to a majority of Americans. But now, Cruz gets to fall back on his cushy $174,000-a-year job as a U.S. senator, with about $9 million left in his campaign war chest and no campaign debt. Presumably, his wife gets to return to her job at Goldman Sachs.

Meanwhile, Cruz has raised his national profile to new heights, and he no longer has to travel the country shaking countless hands, eating terrible food, mangling easy sports references, threatening hecklers with a good spanking, and enduring sharp mockery from Trump, his supporters, and late-night comedians. But those are all fringe benefits. Losing to Trump was a winning proposition for Cruz because winning the Republican nomination would have destroyed Cruz's entire political brand.

From his run for Senate in Texas to his self-styled principled stands once he got to Washington, Cruz has portrayed himself as an untainted, unwavering paragon of conservatism. On the presidential campaign trail, he was the principled "constitutional conservative" that real conservatives could trust. That served Cruz well in the Republican primaries, but it would have been a Barry Goldwater–level disaster in the general election — unless Cruz were somehow able to move significantly to the center. And even if he had somehow been able to pull off a general-election pivot, it would have ruined him — being a principled conservative is Cruz's thing.

Cruz is basically a lock to win re-election to the Senate in 2018. He has a 32 percent favorable and 32 percent very favorable rating among Texas Republicans, and whoever wins the Republican primary will almost certainly win the Senate seat. But his real strength is among self-identified "extremely conservative" voters, and if Cruz abandoned his extremely conservative policy positions to try and win a general election, those are the voters who would remember that perceived betrayal in 2018. Cruz would carry the unshakeable smell of the guy who lost to Hillary Clinton, and he'd be just another untrustworthy, say-anything Washington politician. The "Lyin' Ted" sobriquet would surely be revived by a "consistent conservative" primary challenger, and there's a decent chance he would fall to the same forces he unleashed when he upset David Dewhurst, then the lieutenant governor, in 2012.

Cruz has decisions to make about what kind of senator he wants to be, and how he wants to shape his image after he survived to be the last conservative standing against Trump. If Trump loses, Cruz's stock rises as Republicans play the inevitable what-if game. (You don't think some Democrats are still wondering about Bill Bradley in 2000, or Howard Dean in '04?)

But if Cruz had won the nomination, he wouldn't have those options. Cruz is reputedly as smart as he is unlikeable, so perhaps he understands that by losing, he actually won.