James Comey said a “deciding factor” was attorney general Loretta Lynch’s unusual meeting Bill Clinton June 27, 2016 in Phoenix.

Former FBI director James Comey testifies during a Senate Intelligence Committee hearing on Capitol Hill.(AP Photo)

Former FBI director James Comey said Thursday he took the controversial decision to speak out publicly on the probe into Hillary Clinton’s email last year because he thought his boss, the attorney general, had become politically compromised.

Comey’s unilateral decision to announce last July he was closing the probe -- which turned out to be premature -- infuriated Republicans who thought the Democratic presidential candidate deserved to be prosecuted for mishandling classified information.

Tables were turned on Democrats just weeks before the US election, however, when Comey, again acting on his own, briefly reopened the probe -- a decision Clinton believes cost her the vote.

Asked about the episode at a Senate Intelligence Committee hearing, Comey said a “deciding factor” was attorney general Loretta Lynch’s unusual meeting Bill Clinton June 27, 2016 in Phoenix, Arizona where she joined the former president on his waiting jet when their flights coincided.

Comey also said he was concerned that Lynch was seeking to align the Justice Department with wording that Clinton’s presidential campaign using when referring to the email probe.

“The attorney general directed me not to call it an investigation and call it a matter -- which confused me,” Comey said, adding that he felt he “needed to step away from the department” in order to protect the FBI.

“That was a queasy feeling,” he recalled.

“You look back in hindsight, you think, ‘Should I have resisted harder?’ I said this isn’t a hill worth dying on.”

Republican Senator John Cornyn, grilling Comey, said it appeared he believed Lynch “had an appearance of a conflict of interest on the Clinton email investigation. Is that correct?”