WASHINGTON — U.S. Sen. Lindsey Graham has gone from making jokes about Ted Cruz’s death to endorsing the Texas Republican for president.

It wasn’t, by any stretch, a typical endorsement announcement.

“This is an odd moment, I’ll be the first to say,” the South Carolina Republican told the Capitol Hill press corps Thursday. “It really is an odd alliance, but it’s an alliance I feel comfortable with, given my choices.”

Graham said he was throwing his support behind Cruz out of a belief he stands the best chance of beating Donald Trump, who Graham said was running a campaign “based on xenophobia, race-baiting and religious bigotry.”

“I prefer (Ohio Gov.) John Kasich,” Graham told reporters. “Cruz is not my first pick by any choice, but I don’t see how John Kasich can mount the opposition that Ted Cruz can to stop Donald Trump.”

Graham did concede that Cruz was a reliable opponent of Obamacare and would pick a conservative as the next Supreme Court justice. He also said Cruz was a “friend of Israel,” a timely admission given Graham is hosting a fundraiser for Cruz on Monday at a popular restaurant in downtown Washington, D.C., scheduled to coincide with the American Israel Public Affairs Committee’s annual policy conference.

“In the pro-Israel community, I think I have some resonance,” Graham said. “I’ve sort of dedicated my public life to national security. I’m seen as a strong supporter of Israel. I’m proud of that fact and Ted has been great on Israel and Trump’s approach to Mideast politics is hard for me to understand. And when it comes to Israel it has just been breathtakingly bad.”

Though Republicans are increasingly turning to Cruz out of “anyone but Trump” desperation, most have stopped short at offering up a formal endorsement. Even Gov. Nikki Haley, who had endorsed Marco Rubio prior to the Florida senator’s exit Tuesday night, said Wednesday she preferred Cruz over Trump but made no hint she planned to campaign for him.

Cruz is also unpopular among his colleagues in the U.S. Senate, a fact he has worn as a badge of honor to prove his outsider status and disassociation from what he’s called the “Washington cartel.” Graham even made a joke as the headliner of a recent Washington, D.C., gala that Cruz was so detested in the Senate if somebody killed him on the chamber floor nobody would care.

Until Thursday the only fellow senator to endorse Cruz was Utah Republican Mike Lee.

So while Graham had been saying for weeks he thought Cruz was the best candidate to take out Trump, the full-force endorsement was something of a surprise. After dropping his own presidential run in late 2015, Graham endorsed Florida Gov. Jeb Bush, who suspended his campaign after falling behind in the South Carolina GOP primary.

Graham has also created a long trail of disparaging quotes about Cruz in the past several months, suggesting at one point he was no better than Trump.

“Whether it’s death by being shot or poisoning, it doesn’t really matter,” Graham said in January, comparing the two.

Graham said Thursday that people can take what he says “with a grain of salt, but I’ve come to conclude that Mr. Trump is not a Republican, that he’s an interloper, that he’s jumped into the race that’s all about Trump. His foreign policy’s gibberish, that he’s appealing to our darker side and Ted Cruz is a much more reliable Republican.”

Sign up for updates!

Get the latest political news from The Post and Courier in your inbox.

Graham worried that if voters give the banner of the Republican Party to Trump “we tarnish it, maybe forever. That might be the end of the Republican Party as I know it.”

Asked if he had coordinated with Cruz on the endorsement rollout, Graham said he had not. Graham also couldn’t say whether Cruz was happy about the endorsement given Graham’s less-than-enthusiastic pitch.

“You’ll have to ask him about that,” Graham said. “He certainly welcomes my effort to raise money.”

Cruz is set to be at the fundraiser Monday night.

Emma Dumain is The Post and Courier’s Washington, D.C., correspondent.