President Trump’s former Republican primary challenger Joe Walsh said he would campaign and vote for Bernie Sanders should he be the Democratic nominee.

Walsh, a former Illinois Republican congressman who contested Trump in the Iowa caucuses, wrote an opinion piece published in the Washington Post on Tuesday where he defended his decision to back any Democrat running against the president — including Bernie Sanders.

Other Never Trump Republicans have been more reticent about the idea of voting for a self-avowed socialist like Sanders, but Walsh contends, “That’s not how this works.”

“I sympathize: My congressional career was short-lived, but I came in with the original tea party wave. If it were up to me, Sanders isn’t the guy I’d put in charge,” wrote Walsh, a House member from 2011-13. But when I finally came around to saying, ‘never Trump,’ I meant it.

“And if you’re a Republican who claimed the never-Trump label as a badge of honor during the last few years, to prove to the world that you’re a principled conservative, and not a Trump dupe, then you should have meant it, too,” he wrote.

Walsh dropped from the 2020 Republican contest this month after registering just 1.1% of the state delegate equivalents in Iowa’s first-in-the-nation caucuses, the traditional way of measuring success in the state's nominating contests. Trump’s other Republican challenger, former Massachusetts Gov. Bill Weld, tallied 1.27% in the Iowa vote but received 9.1% in the New Hampshire primary.

Walsh wrote in his op-ed that being a Never Trumper “means you’ll suck it up and support his Democratic opponent, no matter who that is.”

[ Opinion: Against Bernie Sanders, GOP could persuade 'Never Trumpers']

The former congressman supported Trump in 2016 but reversed his support after the president took office. Walsh said that although he worries that Sanders, who is now the Democratic front-runner, would be an easy target for Trump’s attacks, he would still support him and even campaign for him.

“He and I hardly agree on anything, but if he’s the nominee, I won’t just vote for him, I’ll campaign for him,” Walsh said.

“I’d rather have a socialist in the White House than a con man,” he added.

A RealClearPolitics national average of polls has Sanders leading with 29.2% support, followed by former Vice President Joe Biden at 18%. Former New York City Mayor Michael Bloomberg and Sen. Elizabeth Warren of Massachusetts trail them with 14.4% and 12.4% support, respectively.