A popular legend is that Mark Cuban and President Trump were friends that fell out during the 2016 race, but the two have been feuding more than a decade. (Thomas Johnson/The Washington Post)

Setting the actual history aside for a minute, the popular legend of the war between billionaire-turned-celebrity Mark Cuban and billionaire-turned-celebrity-turned-president Donald Trump goes something like this:

Act 1: The men were once friends. “Initially you liked Trump,” is how TMZ’s Harvey Levin phrased it last week, as he interviewed Cuban on Fox News.

“I did,” Cuban said. He had even praised Trump’s candidacy, for a while.

Act 2: They fell out during the 2016 race, as some friends have been known to do. “I told him I was really concerned about a candidate becoming president who was not making an effort to learn the issues,” Cuban explained to Levin.

At the time, Cuban had expressed this concern by publicly calling Trump a “jagoff” who got “stupider before your eyes.” Trump, in turn, called Cuban “dopey,” “not smart” and worse. Their Twitter feud became a sort of symbol for an infamously divisive election.

Cuban briefly retold this whole tale Friday, maybe glossing over the insults a bit, and suggested that its final act may come in 2020 if he runs for president against Trump.

“You need somebody who can connect to people and relate to people at a base level and appreciate what they’re going through,” he told Levin. “I think I qualify on each of those.” Cuban went so far as to tease his plan for health-care reform and weighed out loud on Fox News the pros and cons of challenging Trump in the Republican primary.

Win or lose, it would mark the end of a legend — an old friendship shattered in a few short years. But Trump and Cuban have been feuding, making up and feuding again for much longer than a single election cycle.  They’ve spent most of the 21st century mocking each other’s appearance, intelligence and success and trading insults and dares in a 13-year public war that revolved around their reality TV shows long before either man aspired to the White House.

Two billionaires

You won’t find much in common in the men’s origins. Trump was the son of a New York real estate magnate who then became a New York real estate magnate.

Cuban, in his own words, grew up “dirt poor.”

A New York Times profile recounts how Cuban started his first tech company with a $500 loan in 1982, sold it for millions a few years later and bootstrapped his way up so that by the turn of the century, he was in the billionaire’s club along with Trump.

People in Dallas started comparing the two men after Cuban plunked down $285 million in 2000 to buy the Mavericks, at the time a failing basketball team. Cuban threw piles of cash at the team, the Fort Worth Star-Telegram wrote, pulled eccentric stunts such as working for a day at a Dairy Queen, and racked up $2 million in fines “mostly for derogatory comments about the officiating.”

“You may get the feeling that Mark Cuban thinks the term ‘loose cannon’ is a compliment,” a Dallas Morning News columnist wrote in 2000. “The conundrum is if the Mav owner is a fun-loving rich boy, or, like Donald Trump, has found that flash bulbs can be addictive.”

“The Apprentice” vs. “The Benefactor”

A few more years answered that question. In 2004, Trump made his debut as the host of “The Apprentice,” in which he famously “fired” a contestant each week. The show, which still airs, became a sensation.

Fewer remember “The Benefactor,” which premiered a few months later starring Cuban as its industry titan — and was canceled within its first season. But the show’s brief existence introduced the world to the spectacle of feuding celebrity billionaires.

“I would like to see him do well on the show because I think there’s room for other knockoffs of ‘The Apprentice,’" Trump quipped when the two men ended up in the same room for a press tour, according to the Deseret News.

“I wish Donald nothing but the best for 'The Apprentice 2.' And I hope it does as well as his casinos do,” Cuban shot back, referring to a collection of Trump estates on their way toward bankruptcy.

The Deseret News lamented this “fight among children,” which apparently ended when Cuban claimed he'd been invited to replace Trump on “The Apprentice,” but declined.

For whatever reason, the men’s argument outlived the shows’ rivalry.

“I love working with Mark”

When the Star-Telegram asked Cuban in 2006 whom he might cast to play Trump in a movie about his life, Cuban answered: “The Guy who plays Mini-Me.” Trump in turn eulogized Cuban’s showbiz career on CNN: “There have been 15 versions of 'The Apprentice,'” he said. “Richard Branson failed. Mark Cuban failed. Mel Singer failed. Martha failed. They all failed.”

And then two years later, their differences seemingly forgotten, Cuban’s live-streaming company partnered with a mixed-martial arts promoter Trump partially owned. This resulted in Cuban traveling to Trump Tower in 2009 to hear his old rival praise him like a best friend.

“This is going to be an amazing fight,” Trump told the cameras. “I love working with Mark Cuban. … We love having you involved, Mark. Great honor.”

In one of his many reflections on Trump, Cuban once called theirs a “love-hate relationship.” But if you were paying attention in 2012, when Cuban once again dipped into the Trump-dominated world of reality TV, you'd be hard pressed to find much love between them.

The Twitter wars

In 2012, Cuban became a full-time host of “Shark Tank” in the show’s third season. This turned out to be a much more successful gig than “The Benefactor,” and at the end of the year, Cuban took another swing at his old so-called friend.

Trump, advancing into politics at the time, had just had recently offered $5 million to President Barack Obama if he would produce his college records.

“That was one of the dumbest things ever,” Cuban told a Dallas TV station. “Maybe I’ll put up a million or two if he’ll shave his head.” Cuban looked into the camera and repeated: “Donald, you shave your head, a million dollars to any charity you want.”

Trump responded four days later:

And:

And:

And there was more. In fact, Trump’s anti-Cuban tweetstorm has continued — on and off — up to the present.

According to Trump, Cuban was a “Trump wannabe” in 2013 — “an arrogant, crude, dope who met some very stupid people.” He was a bad golfer in Trump’s estimation in 2014, when the future president explained: “I also have far greater wealth and athleticism!”

But these insults were interrupted with random bouts of nicety, such as when Cuban and Trump complimented each other’s children or when Trump defended Cuban against federal accusations of insider trading.

Such was the complicated state of a friendship in summer 2015 when Trump announced he would run for president and Cuban declared his support.

And this is where most popular versions of the Trump vs. Cuban story begin.

On to the White House

Cuban called Trump’s campaign “probably the best thing to happen to politics in a long time,” as Fortune noted in its timeline of their relationship.

“I don’t care if he says the wrong thing,” Cuban went on. “He says what’s on his mind. He gives honest answers rather than prepared answers. This is more important than anything any candidate has done in years.”

But then Cuban began to flirt with the possibility of entering the race himself. He never did, but his tone took a turn. He called Trump “the guy at the bar who will say anything to get laid.” He predicted a stock mark crash if Trump won. In the end, he endorsed Democratic candidate Hillary Clinton — who rewarded Cuban with a front-row seat at a presidential debate in September.

Trump, true to history, retaliated in words:

He nearly made good on the threat, too, inviting to the next debate several women who had accused Clinton’s husband, former president Bill Clinton, of sexual harassment.

The public warfare seems to have waned, somewhat, since Trump took office. But with varying degrees of fanfare, Cuban has injected himself into nearly every major controversy of the administration.

He attacked Trump’s order barring millions of Muslims from U.S. shores — one of Trump's first moves as president. When Trump demanded football players stand for the national anthem, Cuban told the Dallas Morning News, “They have the right to do what they see fit.”

And when Trump’s government was struggling to aid a hurricane-decimated Puerto Rico (and Trump was feuding with a mayor on the island), Cuban was using the Mavericks team plane to ferry supplies to the island, the Morning News reported.

If anyone saw political aspirations in Cuban’s actions, the Mavericks owner did little to deny the notion. Cuban spoke openly of a possible run against Trump in Austin in March, in Georgia two weeks ago and again on Friday in his interview on Fox with Levin.

“Considering, yes. Made a decision, far from it,” Cuban said, before detailing his fitness for office to such an extent that Levin became convinced Cuban will probably throw his hat in the ring for the 2020 presidential campaign.

“You started this by saying you could kick Hillary Clinton’s a--  and Donald Trump’s a-- if you decided to run,” Levin said at one point.

Cuban agreed, although he didn't mention that the rivalry and insults actually started long before the last election.

Read more:

Trump didn’t play the president in ‘Sharknado 3’ after talks, but here are some of his other cameos

Trump insults and threatens GOP senators in long rant after health bill failure

‘Rocket Man’ enters Trump’s U.N. speech — and the president’s universe of belittling nicknames