Bernie Sanders. Joe Raedle/Getty Images Sen. Bernie Sanders (I-Vermont) admitted Wednesday that he is rooting for Donald Trump to win the Republican nomination.

During a CNN town-hall event, Sanders told moderator Anderson Cooper that he liked his odds against the real-estate mogul.

"Frankly, I'm prejudiced: I want Trump to win the Republican nomination," Sanders said. "I would love the opportunity to run against him. I think we'd win."

Sanders pointed out earlier in the night that some hypothetical head-to-head matchups showed Sanders in a better position than his rival Hillary Clinton to defeat Trump in the general election.

The Vermont senator railed against Trump during Wednesday's town hall. He criticized the tycoon for his plan to deport the approximately 11 million immigrants living in the US without permission, as well as his plan to ban many Muslim tourists and immigrants from entering the US.

"It is not only his bigoted remarks against Latinos, suggesting Mexicans coming into this country are rapists or drug dealers. Or his absurd remark that we should not let Muslims into this country," Sanders said.

Sanders also mocked Trump for his views on wages and climate change.

"Trump in a Republican debate said wages are too high in America. Really? Here's the other one that kind of blows me away: Trump is a scientist, a well-known scientist. And he has concluded, after years of studying the issue, that climate change is a hoax brought to you by the Chinese. Now that shocked me, Anderson, because I thought he'd say the Mexicans or the Muslims."

For his part, Trump said last month that he'd also love to run against Sanders.

"This guy Bernie Sanders, give me a break," Trump said at a campaign rally.

"We haven't even focused on, I mean here's a guy who's a — they say socialist, but some people say he's a communist," Trump continued. "I shouldn't hit him too hard though, because if I hit him too hard then he'll go down, and it'll be a fight with Hillary, and maybe we want a fight for a while. So I'll say, 'Isn't he a wonderful guy?'"

Later on Wednesday, Trump asserted on Twitter that Sanders doesn't actually want to run against the real-estate magnate.