Sen. Bernie Sanders said if 2020 Democrats spend all of their time attacking President Donald Trump along the campaign trial, it will ultimately hurt them at the ballot box.

"If we spend all our time attacking Trump, you know what, Democrats are going to lose," Sanders said. " Our job is to lay out a vision that makes sense to the working families of this country."

Sanders was asked questions on a variety of issues, but he went into particular detail on his healthcare plan.

At one point, a Fox News moderator asked the audience to raise a hand if they would be "willing to transition" from their private healthcare plans to what Sanders is proposing with "Medicare for All." Many across the room cheered and raised their hands.

Visit BusinessInsider.com for more stories.

Sen. Bernie Sanders on Monday said if he and other 2020 Democrats spend all of their time attacking President Donald Trump, then they will lose the election.

"Whether you're conservative or moderate or progressive, I don't think the American people are proud that we have a president who is a pathological liar. It does not give me pleasure to say that ... Trump cannot even tell the truth as to where his father was born," Sanders said during a Fox News town hall.

But then he issued a warning to his fellow 2020 Democrats.

"If we spend all our time attacking Trump, you know what, Democrats are going to lose," Sanders said. "Our job is to lay out a vision that makes sense to the working families of this country."

Sanders went after Trump several times over the course of the evening — including on the issue of releasing tax returns, a matter that the president has received criticism for before and after his election.

The senator had just published 10 years' worth of returns before the town hall started on Monday and urged Trump to follow his example.

But much of the town hall was focused on Sanders' platform and what it would mean for the country as the senator has emerged as the early front-runner in a crowded, diverse field of Democratic candidates.

The Vermont senator was asked questions on a variety of issues over the course of the evening from the Fox News moderators Bret Baier and Martha MacCallum, as well as audience members. Baier said the audience was mixed with Democrats, Republicans, independents, and democratic socialists.

Read more: Bernie Sanders releases 10 years of tax returns after weeks of delays

Over the course of the town hall, Sanders made the case for why voters should not fear tax hikes from "Medicare for All," outlined his foreign-policy vision, explained why he's so concerned about climate change, and championed comprehensive immigration reform.

At one point, Baier asked the audience to raise a hand if they would be "willing to transition" from their private healthcare plans to what Sanders is proposing with Medicare for All.

Many across the room cheered and raised their hands.

Sanders conceded to the moderators his healthcare plan would involve hiking taxes but said healthcare costs would be lower overall because "they're not paying premiums, copayments, and deductibles."

The senator is calling for universal healthcare under his Medicare for All plan, which would provide every American with health insurance via Medicare and eliminate private insurers. A recent INSIDER poll found voters are fairly split on Sanders' healthcare plan, with 43% in favor of it and 45% opposing Medicare for All.

At the end of the town hall, Sanders told the moderators he hoped he wasn't too hard on them and offered his final thoughts to audience members.

Read more: Americans are starting to dislike Bernie Sanders' 'Medicare for All' plan, but there is a Democratic healthcare idea that even Republicans voters like

"I think sometimes the divisions in this country get a little bit too high ... We have a lot more in common than people think we do," Sanders told the audience.

He concluded by urging people to vote in 2020.

"I want to see our country have the highest voter turnout in the industrialized world," Sanders said. "Stand up and fight for a better country."

After the town hall, Sanders' campaign manager, Faiz Shakir, in a tweet acknowledged concerns some groups and people had with the senator appearing on Fox News but added: "If you watched that home run performance for the last hour, you also realized this is the ticket to beating Trump."