ABC News April 15, 2018

The emotional moment Comey shared with Obama after the election

WATCH: The emotional moment James Comey shared with President Obama after the 2016 election

James Comey says he "almost got emotional" with President Barack Obama shortly after the 2016 election, after he had been widely criticized for his handling of the Hillary Clinton email investigation, particularly the letter he sent to members of Congress just 11 days before the election that the FBI had reopened its investigation after finding additional emails. Many Democrats, including Clinton, believe that the announcement so close to the election may well have cost her the presidency.

"He held me back after one of the very last meetings I had with him, after the election, and said he didn't wanna talk to me about any particular case, 'cause he was very scrupulous about that. And he said, 'But I wanna just tell you something generally. I appointed you to be FBI director because of your integrity and your ability,'" Comey said in an exclusive interview with ABC News chief anchor George Stephanopoulos.

"Then he looked me in the eye and he said, 'Nothing has happened, nothing, in the last year that has changed my view of that,'" Comey added.

The interaction was one of many Comey revealed for the first time in the interview ahead of the April 17 release of his book, "A Higher Loyalty: Truth, Lies, and Leadership."

Flatiron Books
A Higher Loyalty: Truth, Lies, and Leadership by James Comey

"Look, he wasn't telling me, 'I agree with what you did,'" Comey said of Obama. "He wasn't telling me, 'You made the right decision.' He was telling me, 'I know where it came from. I know you're not a partisan hack. I know you're trying to do the right thing.' And it meant a lot to me." Comey said in a 2016 Capitol Hill hearing that he had been a registered Republican for most of his adult life but wasn't anymore. He said in the interview with Stephanopoulos that "I had not been a political supporter of President Obama's.”

But over the course of Obama’s time in office, Comey’s feelings changed.

"I came to deeply respect him, and his higher loyalty to the values I care a lot about," Comey said. Comey told Stephanopoulos that in the last 10 days of the 2016 campaign, after he announced that the FBI would be looking back at the Clinton email investigation in connection to emails found on former Congressman Anthony Weiner's computer, he felt like the lead character in the movie "The Sixth Sense," in which Bruce Willis played a man who didn't know he was already dead.

Win McNamee/Getty Images
Barack Obama and James Comey applaud outgoing FBI Director Robert Mueller during a ceremony announcing Comey's nomination in the Rose Garden of the White House June 21, 2013, in Washington, DC.

"I almost got emotional in that moment [with Obama] 'cause, again, I'd been walking around like Bruce Willis in ‘The Sixth Sense.’ And [to] have the president of the United States say, ‘I still respect you for the reasons I did originally,’ meant a lot to me," Comey said.

"I said, 'Thank you, Mr. President. It has been a nightmare … I've just tried to do the right thing.' And he said, 'I know. I know.' And then I said, 'I think my wife would kill me if I didn't take this chance to thank you, and to tell you how much I'm gonna miss you,'” Comey said.

“And also I told him that, 'I dread the next four years. But in many ways, I feel great pressure to stay to try and protect the institution I lead,'" he added.

How Comey “awkwardly hugged” Loretta Lynch

Obama wasn't the first member of the administration to console Comey after the Weiner announcement. He also had an emotive moment with his then-boss, Attorney General Loretta Lynch.

On Oct. 31, in the final days of the campaign, Lynch requested a few minutes alone with Comey after a previously-scheduled meeting.

Lynch "walked towards me with her head down and her arms out. And I'm not a big hugger, but especially -- there was an awkward difference in our height, I guess as there is with me and most people," said Comey, who is 6-foot-8-inches tall. "But she pressed her face against my chest and wrapped her arms around me and then I reached down, as I explain in the book, and kinda awkwardly hugged."

Saul Loeb/AFP/Getty Images, FILE
Attorney General Loretta Lynch speaks at the Department of Justice in Washington, D.C., Nov. 17, 2016

"Then we parted and she said, 'I thought you needed a hug.' And she was right. I'm sure it showed on my face how beaten I felt," he said.

"We sat down and she said, 'How are you doing?' Loretta Lynch is a really good person and has known me a long time ... and I told her that I felt terrible, that I felt beaten … but that I didn't see that I had a choice,” Comey continued. “And then she said something that floored me. She said, 'Would they feel better if it leaked on November the 4th?' And my reaction was … 'Exactly, Loretta.'”

"And so, I don't know, was she telling me, 'You've done the right thing?' And, in a way, hugging me because she feels badly I've taken this incredibly brutal hit? I don't know,” he said. “But I interpreted that as, 'First of all, I feel badly for you. And even if you hadn't made this decision, once you start going to get a search warrant for Anthony Weiner's laptop to look at hundreds of thousands of Hillary Clinton emails, it's likely to leak out anyway.'"

A telling look from Obama

When Comey met with Obama during a later meeting during the transition, he told Stephanopoulos, an unexpected reaction from the outgoing president provided some levity to a tense situation.

James Comey gives first interview since President Trump fired him Comey says his assumption Clinton would win was 'a factor' in the email investigation Comey says Trump asked if he could disprove salacious prostitute allegations in 'dossier'

On Jan. 5, 2017, Comey was part of a team of intelligence department heads who met with Obama and then-Vice President Joe Biden in the Oval Office to talk about how the incoming administration would be told about the intelligence community's findings about what Russia did during the election.

Saul Loeb/AFP/Getty Images
Barack Obama sits alongside James Comey during an installation ceremony at Federal Bureau of Investigation Headquarters in Washington, DC, Oct. 28, 2013.

According to Comey, James Clapper, who had been the director of national intelligence, was the one to tell Obama that included in the briefing that was going to be shared with the president-elect and his team was information that was “particularly salacious that was related to allegations around sexual conduct” of Donald Trump before his candidacy.

It was later determined that the information was connected to the so-called Steele dossier, the intelligence report – portions of which are unverified – written by British intelligence officer Christopher Steele.

Clapper said Comey would be the one to meet with Trump privately after the larger briefing to go over the sexual allegations in the report. Comey told Stephanopoulos that Obama "didn't say a word," but his face said it all.

"President Obama has a great poker face," Comey said, demonstrating how Obama "kind of gave me a -- Groucho Marx is how I thought of it, double eyebrow raise."

"I could be misreading it,” Comey admitted. “But I read it as, 'You poor b------.‘"