Sen. Ted Cruz, R-Tex., addresses the delegates during the third day session of the Republican National Convention in Cleveland, Wednesday, July 20, 2016. Photo: AP Photo/Carolyn Kaster

Sen. Ted Cruz, R-Tex., addresses the delegates during the third day session of the Republican National Convention in Cleveland, Wednesday, July 20, 2016. Photo: AP Photo/Carolyn Kaster

There was a time when Sen. Ted Cruz was considered the GOP’s premier provocateur.

He led a shutdown of the government to repeal Obamacare, even though he had no chance of doing so. He has antagonized his fellow Republicans in the Senate, so much so that Sen. Lindsay Graham half-joked that if someone killed Cruz, no Senator would vote to convict the killer.

Then along came Donald Trump, who made Cruz’s excesses seem puny and who vaporized Cruz’s presidential ambitions in the process. Suddenly, Cruz became irrelevant.

Now Cruz is in the fight of his political life, seeking to win re-election in Texas. He’s facing a strong challenger in Democrat Beto O’Rourke, who is raking in campaign contributions at nearly twice the rate of Cruz.

In addition to being universally despised in a party that somehow embraces the likes of Laura Ingraham and Rep. Steve King, Cruz also holds the distinction of being one of the most anti-LGBTQ senators in a chamber full of them. That makes the constrast between him and O’Rourke all the sharper.

O’Rourke has a track record of support for LGBTQ rights going back more than a decade. As a member of the El Paso City Council, he pushed for domestic partnership benefits, which he says was “a very unpopular and politically inconvenient issue.”

O’Rourke has been a vocal opponent of President Trump’s ban on transgender military personnel. He opposed the nomination of Kyle Duncan to the federal bench, specifically because of Duncan’s long history of anti-LGBTQ animus. “This man has no right passing judgement [sic] on anyone in any courtroom in this country,” O’Rourke said. (The Senate confirmed Duncan anyway.)

Then there’s Cruz.

The list of Cruz’s most bigoted moments is long, but the following gives you a sense of just how awful he is.

There’s plenty more where that came from.

That Cruz is facing a credible election challenge is testament to several factors. One is the changing demographics of Texas, which is increasingly Hispanic. Another is the enthusiasm among Democrats to send a message about their disgust with the Trump administration.

But the last factor is Cruz himself. Polling during his presidential campaign showed that he is really unpopular, even among Republicans. Data guru Nate Silver says he’s on “team Cruz-could-actually-lose,” although he points out that doesn’t mean he will.

As a sign of desparation, Cruz is asking Trump to campaign for him, even though there is no love lost between the two. Cruz pointedly refused to endorse Trump at the GOP presidential convention after Trump insulted Cruz’s wife and suggested that his father was connected with JFK’s assassination.

Trump no doubt loves that Cruz now has to grovel before him. But Cruz can use all the help he can get.

One thing is for sure: he’s never going to get it from his fellow Republican senators.