A top adviser to former President Barack Obama warned Joe Biden against a White House bid in 2016, telling him he would end up in third place in the Democratic primary behind Hillary Clinton and Bernie Sanders.

The behind-the-scenes look at how Biden decided against a run for president four years ago was published by The Atlantic on Thursday, hours after the former vice president announced his 2020 campaign.

As Biden was trying to make up his mind, Obama, who favored Clinton, encouraged him to consult David Plouffe. At a meeting in Washington, Plouffe, who was Obama’s first presidential campaign manager and a trusted political adviser, strongly hinted to Biden that it was time to call it a career.

“Mr. Vice President, you’ve had a great career, you’ve been such an asset to this administration — and we love you,” Plouffe told Biden. “Do you really want it to end in a hotel room in Des Moines, coming in third to Bernie Sanders?”

Despite the discouragement, Biden still made plans for a possible campaign, meeting with aides and drafting an announcement speech in the summer and fall of 2015.

Biden still had not made up his mind up until the night before he declared in the White House Rose Garden that he was not running, saying he needed to sleep on it. Biden called Obama on the morning of Oct. 20, 2015, and later that day made his announcement with his wife Jill and Obama by his side.

The Sanders camp hoped Biden would join the race as a way to boost the Vermont senator's chances. “We were rooting for Biden to get in because we thought there was no way to beat [Hillary Clinton] one on one, but maybe with him in …,” his political consultant Tad Devine told The Atlantic.

Clinton went on to win the nomination, before losing to President Trump in the general election.

Biden, 76, announced his third campaign for president on Thursday morning with a video, promising to salvage the "core values" of the U.S. He leads early polling, but not too far behind is Sanders. According to a RealClearPolitics average of polls, Biden has 29.3% and Sanders is in second place with 23%.

Biden told reporters he asked Obama not to endorse him "and whoever wins this nomination should win it on their own merits."

Although Obama aides say their boss has no intention of endorsing any contender during the Democratic primary tussle, his office did praise Biden.

Choosing him as his running mate "as one of the best decisions he ever made,” said Obama spokeswoman Katie Hill. “He relied on the vice president’s knowledge, insight, and judgment throughout both campaigns and the entire presidency. The two forged a special bond over the last 10 years and remain close today."