Throughout the course of Ted Cruz’s brief Senate career, he made a name for himself primarily by mounting losing campaigns. In so doing, he built up an enormous cache of goodwill with a growing bloc of disaffected Republican voters. Now, to the consternation of the many enemies he made along the way, Ted Cruz is cashing in that goodwill during the course of running the most ruthlessly effective Presidential campaign we have seen in at least a generation.

Ted Cruz’s introduction to America at large was during the course of a shutdown over Obamacare that he was primarily responsible for causing, and which ultimately did not succeed in getting Obamacare repealed. His GOP Senate colleagues were less than amused at his tactics, and thus began the process of Ted Cruz endearing himself to Republican voters at the expense of Republican Senators.

Over the course of the years he repeatedly engaged in procedural tricks that were often described as too cute by half and that seldom (if ever) succeeded at accomplishing Cruz’s stated objective. Some of these have even come back to haunt him during the course of this primary campaign, such as his maneuvering over amendments to an immigration bill that have opened him to attacks from Rubio on that flank. They moreover alienated almost everyone else in the Senate, culminating in late September, when Senate leadership was able to deliver a nearly unanimous rebuke to Cruz’s efforts to offer an amendment on defunding Planned Parenthood.

Allegedly, during the course of this vote, when it became clear that McConnell had successfully cowed everyone other than Mike Lee into abandoning Cruz’s effort, McConnell turned around and pointedly stared at Cruz, as if to gloat over his seemingly total victory over Cruz’s disruptive antics in the Senate.

I have to imagine, though, that on the inside Cruz was bursting with glee about the prospect of headlines declaring him alienated from the entirety of the Senate GOP, and from McConnell in particular. Cruz knew – as he has known all along – that such headlines would only serve to buttress his by-now nearly invincible standing as the single person in the Senate who was willing to stand against “the Establishment” no matter the cost.

Having built up virtually indestructible goodwill by engaging in campaigns he knew would be failures, Cruz has been busy this campaign season spending that goodwill on a Presidential campaign that has has been astonishingly effective from a strategic standpoint, and has been characterized by a laser-like focus on winning at any cost. Some of the things he has done to accomplish this goal would have sunk a candidate with a less dedicated following.

For instance, as widely disliked as Donald Trump is by those who are not already committed to supporting him, it is probable that none of the other Republican contenders could have afforded the open embrace of Trump that Cruz has engaged in since day one of Trump’s campaign. If Rubio, Christie, or Bush had attempted to cozy up to The Donald from day one, their supporters would have likely resented it and fled elsewhere.

Cruz’s most loyal supporters do not find his embrace of Trump any less distasteful than his detractors do. However, because they have come to believe in Cruz unconditionally, they are willing to trust in Cruz’s strategery and overlook his blatant gamesmanship with respect to Trump’s supporters, because they trust that his core is solid. Likewise, the many Cruz supporters I know who are also fans of Marco Rubio find the aggressive tone he has taken with Rubio to be offputting – but again, he has established enough goodwill that his attacks on Rubio are not a deal breaker for them, either.

The end result of Cruz’s machinations is that he has put himself in the catbird’s seat, less than a month from the Iowa caucuses. As the Wall Street Journal chronicled earlier this week, the GOP is currently split into three factions of roughly equal size. The first are Trump supporters, who tend to be blue collar, disaffected Democrats and are largely otherwise outside easy characterization. The second are the evangelical social conservatives, which have lined up roughly 2/3 behind Cruz and 1/3 behind Carson. The third is the “establishment” bloc, which is the most fractured of all but is now led by Marco Rubio.

As the election moves forward, and candidates drop out, the WSJ’s polling indicates what conservatives have intuitively known for some time. Neither the social conservatives nor the establishment voters will vote for Trump under any circumstances. The evangelical wing is willing to support Rubio if Cruz craters, and the establishment wing is willing to support Cruz. The Trump wing is willing to support Cruz, but not Rubio.

The end result is that Cruz has set himself up to be the candidate who stands to gain the most from the losses of literally every other candidate in the race. His campaign is additionally richer than Croesus to ensure that he can stay around to see that start to happen. He has firmly grasped second place from all the other candidates, and recent state polling that shows Cruz leading in California (of all places) indicates that Trump’s lead may be more precarious than otherwise believed.

You may not like every lever that Cruz has pulled during the course of this campaign, but from a strategic perspective, they have all been the right ones. Even extremely risky strategic decisions – like his decision to poke his finger in the eye of King Corn and gamble on evangelical loyalty – have paid off.

Ted Cruz may not win the nomination when all is said and done, but absolutely no one would have predicted last year at this time that he would be in a position this good as we come down the stretch toward Iowa. Moreover, Cruz unquestionably eclipsed the smug Republican Senate establishment, including Lindsey Graham, who had to slink back to South Carolina – with John McCain in tow – after being summarily unable to raise money or even command votes in his home state.

How it must grate on Mitch McConnell’s nerves to have to fundraise for the NRSC these days almost exclusively based on appeals to Ted Cruz’s popularity, a fact for which any conservative can be grateful, or at least have a good chuckle.

In retrospect, it is clear that Ted Cruz was never playing to lose in the Senate; rather, he’s been playing to win the Presidency from day one. And he’s been playing extremely well.