James Comey's new book describes attempts to defend himself from what he saw as inappropriate meetings with President Donald Trump.

Comey, who was fired as FBI director in May, said Trump asked him to meet privately twice and seemed to lean on him for political advantage.

Comey said he asked Jeff Sessions, the attorney general, to "be between me and the president."

He said Sessions responded by not meeting his gaze, darting his eyes around, and letting Comey know he was on his own.

James Comey has accused Attorney General Jeff Sessions of shirking the responsibility of standing up to President Donald Trump to prevent him from trying to subvert the independence of the FBI.

Comey, who Trump fired as FBI director in May, described Sessions ignoring a direct plea to help him avoid situations where he was left alone with Trump, a violation of US government norms that he saw as undermining the FBI's independence.

In "A Higher Loyalty," Comey's memoir set to be released Tuesday, Comey said he made the request of Sessions after the second time Trump drew him into a private conservation that Comey described as an attempt to gain political advantage.

President Donald Trump shakes hands with Comey at the White House in January 2017. Andrew Harrer-Pool/Getty Images

Comey described meeting Sessions at a secure conference room inside the Department of Justice, shortly after Trump asked Comey to stay behind after a White House intelligence briefing:

"When the room was clear, I did what I had promised the president and passed along his concerns about leaks and his expectation that we would be aggressive in pursuing them.

"Under the optimistic assumption that the attorney general had any control over President Trump, I then took the opportunity to implore him to prevent any future one-on-one communications between the president and me.

"'That can't happen,' I said. 'You are my boss. You can't be kicked out of the room so he can talk to me alone. You have to be between me and the president.'

"He didn't ask me whether anything happened that troubled me, and I didn't say, for reasons discussed above. Instead, in a move that would become familiar to me, Sessions cast his eyes down at the table, and they darted quickly back and forth, side to side.

"To my memory, he said nothing. After a brief moment of eye darting, he put both hands on the table and stood, thanking me for coming.

"I read in his posture and face a message that he would not be able to help me."

In the one-on-one meeting, Comey says, Trump seemed to suggest that Comey should stop the FBI's investigation into Michael Flynn, the former national security adviser, related to his communications with Russians.

Sessions and Chuck Rosenberg, then the head of the Drug Enforcement Administration. Comey is in the background. AP

It followed the now well-known "loyalty dinner" at which, Comey says, Trump asked for his allegiance, a request Comey has likened to the behavior of a mob boss.

Comey saw the meetings as an attempt by Trump to drag the FBI into political matters. Describing his discomfort, Comey wrote:

"The head of the FBI could not be put into the position of meeting and chatting privately with the President of the United States — especially after an election like 2016.

"The very notion would compromise the Bureau's hard-won integrity and independence."

Comey has taken aim at Trump's character in the book and in media appearances. In an interview that aired Sunday on ABC, he said Trump was "morally unfit" to be president.

Meanwhile, Trump has derided Comey in recent days, referring to him on Twitter as a "slimeball" and suggesting he ought to be jailed.