Joe Walsh, a former Illinois congressman who announced a primary challenge to President Trump last year, has ended his long-shot bid for the Republican nomination, he said on CNN Friday morning.

On CNN, Walsh called Trump a “dictator” and said he would support “any Democrat” for president over Trump.

Walsh, a tea party activist who hosted a talk radio show, once supported Trump but became one of the most prominent Republican voices to break from him shortly after Trump took office. Walsh launched his campaign in August, declaring Trump “unfit” for office and saying conservatives should have an alternative in 2020.

Over more than five months of running for the GOP nomination, however, Walsh grew convinced Republicans who supported Trump were part of a “cult” and under a “spell,” he wrote in an op-ed Thursday for The Washington Post.

“More than anything else, what’s made this challenge nearly impossible — to a degree that I didn’t fully realize when I first hit the trail — is how brainwashed so many of my fellow Republicans seem to have become,” Walsh wrote.

Deciding to challenge Trump was “the hardest thing I’ve ever done,” Walsh later told The Post. Shortly after he announced his campaign, Walsh lost his radio show. He received threats, including a package that was dropped off at his home containing a T-shirt from his old radio show, with a target added to the back.

Fundraising was “dreadfully difficult,” according to campaign manager Lucy Caldwell. Walsh’s sizable radio audience and social media following didn’t necessarily translate to small-dollar donors, and would-be supporters who could have made large donations often were not willing to do so directly, lest their names become public.

“It’s just like Republicans in Congress. They privately say ‘I’m with you’ but they’re so afraid of coming out publicly,” Caldwell said.

The final straw, Walsh said, was attending an Iowa caucus Monday night in which he addressed about 3,000 Republicans. Many booed him — or even flipped him off — when he suggested Trump lies frequently and makes every day about himself.

“It confirmed for me that the party is a cult,” Walsh said. “That Donald Trump doesn’t have supporters, he has followers, and the vast majority of them would not support any Republican challenger. . . . It just became clear to me: I can’t keep beating my head against the wall.”

Walsh’s departure leaves former Massachusetts governor Bill Weld as the only Republican challenger to Trump, albeit one who has not been able to gain much traction. Early Monday evening, Trump was easily declared the winner of the Iowa Republican caucuses, though it remains unclear whether Weld or Walsh secured any delegates. (The Iowa Republican Party did not immediately respond to a request for comment.)

Meanwhile, Walsh is unsure of his next steps but said he is “pledged to stopping Donald Trump, period.” What he didn’t want to do by staying in the race, he said, was take away support from moderate Democrats who might be appealing to those who had left the Republican Party because of Trump. Across Iowa, he said he frequently encountered disaffected conservatives who were pondering supporting Sen. Amy Klobuchar (D-Minn.) or former vice president Joe Biden.

“I spoke to so many Republicans who said, ‘Joe, I love you and I’m with you and I love what you’re doing with Trump,’ ” Walsh said.

But, he said they would always add, they just didn’t think he stood a chance against the president.

“[They would tell me] ‘So I’m going to caucus with the Dems. I’m gonna caucus with Klobuchar or Biden,’ ” Walsh said. “I heard that multiple times a day . . . all over the state.”

Walsh said he has not endorsed a candidate in the Democratic primary but would be open to voting for one in the November general election.

“I would vote for any Democrat over Donald Trump, because I firmly believe Trump is a bigger threat,” he said.