Barack Obama says he would have beat Donald Trump in the election. Here are the facts.

President Barack Obama said he would have defeated Donald Trump in the 2016 election had he been allowed to run for a third term. 

That prompted Trump to vehemently disagree, tweeting there was "NO WAY!" Obama would have won Nov. 8.

The truth, however, lies somewhere in the middle. Let's break it down.

Obama's argument

In an interview with former White House advisor David Axelrod, Obama said he would have held onto his winning electoral coalitions from 2008 and 2012 and beat Trump if there were no term limits prohibiting him from running for a third term in 2016.

"I am confident in this vision because I'm confident that if I had run again and articulated it, I think I could've mobilized a majority of the American people to rally behind it," Obama said during Axelrod's podcast, published Monday.

Trump's argument

Trump, however, says he would have beat Obama thanks to the country's economic situation, the rise of ISIS and the growing cost of Obamacare — the president's signature health-care law.

The facts

Let's start off with the disclaimer that debating whether a hypothetical candidate would have won is always a futile exercise. 

First, electoral outcomes are the product of a number of internal and external factors, including campaign organization, messaging, response to outside events beyond a candidates' control and how the media frames and covers the election — not to mention the unpredictability of 140 million people.

"Who would have won? Nobody knows," said Stuart Rothenberg, a nonpartisan political handicapper and Washington Post columnist. "There's so many factors that would have changed that you don't know if the outcome would have been different." 

But there are a number of data points indicating Obama would have been in a strong position had he been the Democratic nominee.

First, polling showed voters favored Obama over Trump by a 53% to 41% margin.

Obama is also far more popular than Trump, with 54% of voters approving of the job he's doing, according to RealClearPolitics' average.

Trump, on the other hand, has the lowest approval ratings — 43% — of any incoming president, according to Politico.

Data also shows Hillary Clinton underperformed Obama among key parts of his coalition, including African Americans and younger voters. 

Just 80,000 people in the states of Michigan, Pennsylvania and Wisconsin decided the outcome of the 2016 election. It's possible young people and minority voters — who, in wide margins, voted for Obama in both 2008 and 2012 — could have flipped the outcome of the election had they voted in higher numbers.

Since Obama remains popular with those groups, it's possible they would have come out to vote in 2016 and handed him a win in the Electoral College.

In addition, data suggests Clinton may have won were it not for FBI Director James Comey's last-minute letter effectively reopening the "email" investigation, according to FiveThirtyEight's Nate Silver.

Since Obama wasn't being investigated by the FBI during the campaign, he likely wouldn't have had to overcome the FBI's involvement in the election.

Despite all this, debating whether Obama would have won is a useless counterfactual game.

The fact of the matter is Obama wasn't on the ballot. Trump was — and he won.

Trump's performance over the next four years will determine how each party fares at the ballot box in 2020.

"This current period is surreal, because you have Donald Trump tweeting and talking about what he's going to do and promising success, and yet we're not in a position to actually judge what he has done," Rothenberg said. "And, as you know, politics is about what you produce and who you produce for."