Former FBI Director James Comey says President Obama's decision to comment publicly on the Hillary Clinton email investigation while it was ongoing was one of the drivers behind his own infamous decision announce the results of the probe himself.

Comey says Obama in effect compromised his own Justice Departments with public statements the president made about Clinton that minimized her conduct in having a private email server while the investigation was still going on.

In one comment referenced by Comey, Obama had told Fox News that Clinton 'would never intentionally put America in any kind of jeopardy.' In another, to '60 Minutes,' he said Clinton had made a 'mistake' but said it was 'not a situation in which America's national security was endangered.'

Comey referenced the comments in his bombshell interview with ABC's George Stephanopoulos, saying: 'He shouldn't have done it.'

'He shouldn't have done it': Former FBI Director James Comey criticized President Obama's decision to talk publicly about the Clinton email investigation while it was ongoing

'First of all, we had the problem that President Obama had twice publicly basically said, 'There's no there, there,' Comey said, making his own characterization of Obama's comments.

'In an interview with-- on Fox, an interview on 60 Minutes I think, both times he said that. So that's his Justice Department,'Comey said.'

It really did surprise me. He's a very smart man and a lawyer,' said Comey, who went out of his way to gush about Obama in his new book, 'A Higher Loyalty.'

'And so it surprised me. He shouldn't have done it. It was inappropriate.

Comey listed the episode as among the trio of events that influenced his widely criticized decision to announce the decision not to prosecute Clinton, even as he chided her for being 'extremely careless' with her emails.

MISTAKE: President Barack Obama told CBS '60 Minutes' in 2015 Hillary Clinton had made a 'mistake' with her emails but said it was 'not a situation in which America's national security was endangered'

BY THE BOOK? Obama had told Fox News Sunday host Chris Wallace Clinton 'would never intentionally put America in any kind of jeopardy'

George Stephanopoulos asked if he thought Obama was 'trying to color the case' by speaking about it

Stephanopoulos asked if he thought Obama was 'trying to color the case?'

'I don't know. I don't think so. He didn't have any insight into the case, at least as far as I know, more than anybody reading the newspaper did, which was zero 'cause there were no leaks. I think he felt a pressure in the political environment because he wanted Hillary Clinton to be elected, to give her a shot in the arm,' said Comey.

'And so he spoke about an investigation. And he shouldn't have done that. But that, as you can imagine, created this drumbeat that the Obama Justice Department, the fix is in because the president has told them what result they should reach,' he said.

Stephanopoulos responded: 'So that's one reason that the Justice Department is compromised. What's reason number two?'

Comey gushes about former President Obama in his new book, but also says he might have tried to influence how his Justice Department handled the Clinton probe

Comey didn't contest the use of the word 'compromised,' then went on to discuss 'classified information came into the possession of the U.S. intelligence community,' as well as former attorney general Loretta Lynch's infamous tarmac meeting with Bill Clinton on an airport tarmac.

But he said he believes Lynch's version of events, and doesn't think Clinton would have been foolish enough to try to obstruct justice by pressuring her on the investigation of his wife.

'I find it hard to believe that Bill Clinton would've tried to obstruct justice by walking across the tarmac in front of ... in front of a bunch of F.B.I. agents up the stairs and onto an F.B.I. plane,' said Comey.

Comey says President Donald Trump may have tried to obstruct justice by asking him to let go a probe of fired national security advisor Mike Flynn

Even as he spoke about the investigation in his first interview with 'Fox News Sunday' as president in 2015, Obama denied any effort at political influence.

'I guarantee that there is no political influence in any investigation conducted by the Justice Department, or the F.B.I. — not just in this case, but in any case. Full stop. Period,' Obama said.

Of Hillary Clinton, who he would go on to campaign for in hopes of preserving his policy legacy, he said: 'Here's what I know — Hillary Clinton was an outstanding secretary of state. She would never intentionally put America in any kind of jeopardy.'