Newly revealed emails detail how Hillary Clinton's allies scrambled last year to head off a brewing presidential bid from Vice President Biden -- showing just how close he came to running and the role an ex-Biden aide played in the "demise" of that idea.

Biden was well-known to have considered challenging Clinton, the eventual Democratic presidential nominee, to be the party’s standard-bearer before taking himself out of the running a year ago.

However, the hacked emails of Clinton Campaign Chairman John Podesta that have been released by WikiLeaks pull back the curtain on how seriously Biden was planning for a campaign – and how seriously Clinton’s staffers took that threat.

BIDEN WISHES HE COULD TAKE TRUMP 'BEHIND THE GYM'

The first mention of a Biden run in the Podesta emails came on June 11, when former U.S. Ambassador to Hungary Eleni Kounalakis told Podesta that a wealthy Bay Area broker “swears Biden is running. He said he took him on Air Force Two, and he’s getting emails.”

Podesta then referenced the recent death of Biden's 46-year-old son Beau, who had cancer.

“Some speculation that Biden will run because of Beau’s loss,” Podesta wrote back. “I think that would be a little crazy and sad but you never know. I like him and grieve for him and hope he doesn’t do it for his sake.”

The Biden speculation jumped into high gear for Team Clinton after Maureen Dowd wrote an Aug. 1 column for The New York Times in which she said Beau, before he died, had pushed his dad to run for president. The column angered many in the Podesta-Clinton orbit, though it didn’t immediately seem to change the calculus.

“I think he’ll hang back unless she explodes and that won’t happen just because your friends at the [New York Times] wish it so,” Podesta wrote to CNBC’s John Harwood the same day the Dowd column came out.

But by mid-month, President of the Center for American Progress Neera Tanden emailed Podesta with news that a hedge fund manager reported “that Biden (or his people – unclear to me who) are calling asking for support. Not doing a hard sell.” Podesta indicated he had heard the development, as well.

Just days later, on Aug. 23, Podesta advised New York City Mayor Bill de Blasio about how to answer potential Biden questions, adding a pro-Clinton spin: “Great guy, serious, grieve with him on the loss of his son, he has to make up his own mind whether to run, no big clamor out there for additional candidates.” Podesta on Aug. 24 told an inquiring Harwood that he now was “not sure” if Biden was leaning toward running.

Biden’s campaign appeared to be gearing up by the end of the month, when, on Aug. 28, a former White House staffer informed Podesta that Democratic consultants out West were being calling by Biden’s Chief of Staff, Steve Ricchetti, asking them to be regional coordinators or consultants for a campaign.

On Sept. 2, Podesta emailed Tanden: “Heard he is now telling union Presidents he is running.”

At that point, Clinton aides seemed to go from information-gathering to a more pro-active approach.

Podesta told Clinton in a Sept. 21 email that he had lunch with President Obama and discussed Biden. He didn’t reveal via email “the color of the conversation,” preferring to speak on the phone. But he did tell Clinton the news was “Nothing that can’t wait.”

Podesta next moved to shoring up those already likely to support Clinton. He spoke to Los Angeles Mayor Eric Garcetti and told top Clinton aide Huma Abedin on Sept. 23 that Garcetti “won’t commit until Biden is definitive. Probable outcome is he stays neutral followed closely by he endorses Biden.”

Podesta went directly to Clinton regarding ex-UBS CEO Robert Wolf.

“Most importantly, Biden is courting him hard,” Podesta wrote. “He has told Biden he is with you, but Biden has pushed him to reconsider if he gets in or at least stay open to that possibility. Because Robert is known as an Obama confidante, he would probably be seen as a bellwether of Obama’s preference and there is no question that Biden would market it that way if he were to defect. He’s not just one more Obama fundraiser. I think he believes you would be the better President so I think he’s solid, but not rock solid.”

Wolf emailed Podesta 10 days later providing him with an agenda for a meeting the two were scheduled to have. Item 3 is “VP Biden update.”

On Oct. 12 Podesta forwarded an email from a Chicago “super-volunteer” with updates on the area to a group that included Clinton campaign manager Robby Mook. Podesta noted Chicago is “probably a place Biden will try to play so we should pay some attention.”

It’s unclear what happened next, but, just three days later, the Biden threat appeared vanquished. Ron Klain, a former Biden chief of staff who is now an operative for the Clinton campaign, emailed Podesta with a cryptic note of thanks.

“It’s been a little hard for me to play such a role in the Biden demise – and I am definitely dead to them -- but I’m glad to be on Team HRC, and glad that she had a great debate last night,” Klain wrote.

Six days later, on Oct. 21, Biden, with Obama by his side, gave a news conference from the White House declaring he wouldn’t run.

Clinton, in a statement, said: “I am confident that history isn’t finished with Joe Biden.”