Sen. Ted Cruz (R-TX), one of the most disliked members in the U.S. Senate, has done it again.

On Tuesday night, the Texas Republican defeated Democratic challenger and liberal rising star Beto O’Rourke, in one of the most widely covered and breathlessly polled races of the 2018 midterms.

Cruz was always the odds-on favorite to win, but O’Rourke and his campaign were able to keep the election just close enough that Team Cruz and Republican strategists had been sweating for weeks.

In the home stretch of the campaign, Cruz used everything in his arsenal to paint O’Rourke as a radical leftist, even resorting to extremely conspiratorial claims and nativist appeals.

“Two basic Qs every reporter should ask Beto…(1) should the ‘caravan’ be allowed to cross illegally into Texas? (Beto refuses to answer.) And (2) did your campaign dollars illegally fund their doing so?” Cruz had tweeted on the Friday before Election Day, referencing a Project Veritas sting video that allegedly showed O’Rourke staff talking about ways to hide charity to migrant families huddled in Texas churches.

In the end, all the fuss was all for naught, with Cruz winning with a comfortable margin. Still, over the course of the last two months, GOP leaders in the Senate, the Republican National Committee, and the Trump White House had all feared that the Texas senator, saddled with his famous unlikability, would find a way to blow the election and a safe seat. The past couple of months have seen the Republican Party launching a rescue mission for Cruz, one that included President Donald Trump announcing that he would hold an October rally for Cruz—his former, bitter enemy—in Texas.

But by the time Trump arrived in Texas last month, Cruz’s fortunes and poll numbers had improved considerably. The president’s political advisers had even urged him to cancel the campaign stop, as their analysis now showed Cruz winning easily.

Still, Trump held the pro-Cruz mega-rally—and proceeded to make it all about Trump.