Sen. Bernie Sanders of Vermont on Monday pledged to work with whomever the 2020 Democratic nominee for president ultimately is to ensure President Donald Trump is not reelected.

"I hope I'm the nominee, but if I'm not I'll work with that nominee," Sanders said during a CNN town hall. "Trump has got be be defeated."

Sanders announced last week that he's running for president again, and has since raised $10 million for his campaign as of Monday.

Sen. Bernie Sanders on Monday said he'll support the Democratic nominee for president no matter what, citing the importance of defeating President Donald Trump.

"I hope and believe that every Democratic candidate will come together after the nominee is selected and make certain that Donald Trump is not reelected president of the US," Sanders said during a town hall with CNN in Washington, DC. "I pledge certainly to do that."

"I hope I'm the nominee, but if I'm not I'll work with that nominee," Sanders added. "Trump has got be be defeated."

Sanders in 2016 was criticized by supporters of former Secretary of State Hillary Clinton who felt he did not drop out of the race early enough to support her. The Vermont senator did ultimately endorse her at the Democratic National Committee and campaigned all over the country for Clinton ahead of the general election, but there are ongoing tensions between Sanders' camp and former Clinton staffers over this issue.

Later during the town hall with CNN on Monday, Sanders said Trump is a "fraud" and a "pathological liar," characterizing the president as someone who's claimed he's behind the working class but really works for the billionaire class.

Read more: Bernie Sanders' foreign policy adviser breaks down the senator's progressive global agenda for 2020

Sanders and Trump have been going back and forth since the senator announced he's running again last week.

After the president revived his 2016 nickname for Sanders — "Crazy Bernie" — the senator said Trump is "a racist, a sexist, a xenophobe and a fraud."

"What's crazy is that we have a president who is a racist, a sexist, a xenophobe and a fraud," Sanders said in a tweet. "We are going to bring people together and not only defeat Trump but transform the economic and political life of this country."

In roughly a week since announcing, Sanders' campaign has raised a whopping $10 million.