Donald Trump ordered the Justice Department to justify his firing of FBI director James Comey in 2017, according to a new book by Mr Comey’s former deputy.

In the upcoming memoir, former FBI deputy director Andrew McCabe details deputy attorney general Rod Rosenstein’s upset at allegedly being asked by the White House to draft a now notorious memo in which he advised Mr Comey’s removal.

Mr McCabe writes how, in a private meeting with Mr Rosenstein after the firing in May 2017, the 54-year-old appeared “glassy-eyed” and emotional.

“He said it wasn’t his idea. The president had ordered him to write the memo justifying the firing,” writes Mr McCabe, who added Mr Rosenstein was having trouble sleeping after concluding he had been scapegoated by the White House.

“There’s no one here that I can trust,” he quotes the deputy attorney general as saying.

The book, The Threat: How the FBI Protects America in the Age of Terror and Trump, of which an advance copy was obtained by The Guardian, is due on sale later this month.

Publicly, Mr Rosenstein has defended the memo, which criticised Mr Comey’s handling of an FBI investigation into former presidential candidate Hillary Clinton’s use of a personal email account.

In testimony to congress last year, Mr Rosenstein sided with the White House’s version of events, when he said of the memo: “I wrote it. I believe it. I stand by it.”

President Trump: a year of high drama at home and abroad Show all 36 1 /36 President Trump: a year of high drama at home and abroad President Trump: a year of high drama at home and abroad Reuters photographer Hannah McKay (Britain's Prime Minister Theresa May and U.S. President Donald Trump walk away after holding a joint news conference at Chequers) "This was the third and final time I was photographing Donald Trump during his working visit to the UK. I'd noticed he had a tendency to hold Theresa May by the hand when they used stairs, so I lay on the floor for fifteen minutes waiting for the pair to exit via some steps. As they did, Trump took May by the arm and shouted over his shoulder, "Yes" in response to the question "Mr. President, will you tell Putin to stay out of the U.S elections?" - from a reporter in the press conference." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (President Trump confers with White House Communications Director Hope Hicks as Press Secretary Sarah Sanders listens) "I stayed in the room after our reporters had left, and seemingly unnoticed like the cliched 'fly on the wall', I was witness to this unusual moment." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Chris Bergin (A supporter of Trump and Republican senate candidate Mike Braun at an election night party in Indianapolis) "I saw the colour-coordinated woman in the back of the ball room while covering mid-term elections. She stood out to me because she was lit by a single overhead light that created deep shadows." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Shannon Stapleton (Stormy Daniels, puts her shoe back on after passing through a security screening, as she arrives at federal court) "On the morning that I took this picture there was a mad scrum outside the courthouse to get a picture of Stormy Daniels. She didn't enter the regular entrance of a media gauntlet that was set up for her. I placed myself by a window where I saw her passing through the metal detector. Shooting through the window was difficult but I was able to make the frame." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump appears on the South Portico of the White House with the Easter Bunny during the annual White House Easter Egg Roll) "There are many holiday events at the White House, but one of the most light-hearted happens during Easter, when the President shows up at the balcony of the South Portico accompanied by someone in a big Easter bunny costume. I didn't have the best position, but towards the end, the bunny stood behind the President and I was able to take this shot." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (Melania Trump wearing a jacket with the phrase "I Really Don't Care. Do U?" on the back after a visit to the US-Mexico border in Texas) "I could not see the words on Melania's jacket when she boarded Air Force One. I only heard about it once airborne. But there was no way I was going to miss it again, and to my utter astonishment, she was wearing it once more upon her return to Washington." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (A White House staff member reaches for the microphone held by CNN's Jim Acosta as he questions President Trump during a news conference following the midterm congressional elections) "Covering politics has always felt to me like photographing a live theatre production - the actors and stage are usually set in a familiar way. But even if you've seen a specific play many times, there is always the possibility that there will be something exciting or new. It became obvious during this exchange that the dialogue was going in a different direction than expected, and I took it as a cue to make sure I gave the scene extra attention." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (Trump boards Air Force One for travel to Ohio) "We photograph departures and landings hundreds of times. Sometimes, as in this case, the clouds or the light can give you a little gift." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (Donald and Melania Trump stand beside French President Emmanuel Macron and his wife on a visit to the estate of the first US President George Washington) "I'm always happy for events that take us off the White House campus and provide new visual opportunities. This day, when the Trumps feted the Macrons at George Washington's historic estate, it provided just the right contrast for the stylish leader-couples as they took their spots for an otherwise posed moment." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (President Trump gestures after arriving in Pennsylvania to take part in the annual September 11 observance) "Celebratory fist pumps on a national day of mourning and reflection caught even the most seasoned of us off guard." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Peter Nicholls (Demonstrators fly a baby Trump blimp in London's Parliament Square, during his UK visit) "I took this picture of the Trump blimp from a wall at the back of Parliament Square, to get a clear view from above the crowd, as it was revealed for the first time, prior to a day of protests during his visit to the UK, mid-July." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (President Donald Trump and North Korea's leader Kim Jong-un walk together before their working lunch during their summit in Singapore) "On a historic and difficult day, it was fun to look for the odd angle or expression. Here, Trump and Kim walk away after impromptu remarks to reporters - which clearly pleased the North Korean leader." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Ronen Zvulun (Ivanka Trump and US Treasury Secretary Steven Mnuchin stand next to the dedication plaque at the new US embassy in Jerusalem) "I shot this picture when I was standing on a platform really close to Ivanka Trump. I knew exactly where to stand and what lens to use because I did a tour the day before. I knew this was the key picture we had been waiting for since the story broke some weeks before." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (The imprint of French President Emmanuel Macron's thumb across the back of Trump's hand at a bilateral meeting at the G7 Summit) "This is taken right after the first photo-op the two presidents had at the G7 summit after they had a tense back-and-forth on Twitter. They were smiling but Macron gripped Trump's hand quite hard and I noticed that it left a visible impression on Trump's hand." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (President Trump meeting with Russian President Vladimir Putin in Helsinki) "Body language can give an ordinary photo much more meaning, and here, Trump and Putin did not disappoint." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Joshua Roberts (A father of a Florida shooting victim tries to shake hands with Brett Kavanaugh during his US Senate Judiciary Committee confirmation) "This moment happened in a break in testimony. Kavanaugh seemed surprised as Guttenberg approached but as he turned away he looked anxious. Kavanaugh later said he did not understand who Guttenberg was at the time." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlo Allegri (First lady Melania Trump visits the Pyramids in Cairo) "The First Lady had taken a tour of African nations and could not depart the continent without a visit to the incredible pyramids of Egypt where I, as part of the traveling press pool, was able to make this photo of her looking out over Giza Pyramid Complex." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Brian Snyder (Trump and Germany's Chancellor Angela Merkel hold a joint news conference in the White House) "The East Room felt tense even before President Trump and Chancellor Merkel entered for their joint news conference. With Merkel's podium behind the President's from my vantage point, she seemed to want to keep an eye on him. The East Room was very full for the joint news conference, with photographers on ladders all around the perimeter." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (White House counselor Kellyanne Conway gives an interview at the White House) "This is a fairly common scene at the White House, especially with Kellyanne Conway. Often the press will wait yards off while she or another member of the Trump administration gives a live interview. Conway will then walk past the rest of the press, and everyone hopes that she will give another interview to the group." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Francois Lenoir (President Trump attends a meeting of the North Atlantic Council during a NATO summit in Brussels) "I like the contrast in the photograph. The presence of U.S. President Trump posing smiling and the lack of interest of the officials in the background." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (Thomas Musolino wears a mask of President Trump while holding his daughter Gianna during a Trump campaign rally) "The President's rallies are well-known at this point, we attend a lot of them as members of the White House travel pool. This father-daughter situation really stood out from the crowd because of the juxtaposition of the mask and the tenderness between the two of them." REUTERS/Leah Millis SEARCH "TRUMP POY" FOR FOR THIS STORY. SEARCH "REUTERS POY" FOR ALL BEST OF 2018 PACKAGES. TPX IMAGES OF THE DAY. LEAH MILLIS Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump observes a demonstration with US Army 10th Mountain Division troops as he visits Fort Drum) "President Trump often talks about how much he likes big planes and tanks, and the 'beautiful military.' This summer he had a up-close look during a visit to a military base in New York state, where he signed the National Defense Authorization Act." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jim Bourg (Christine Blasey Ford closes her eyes as she is sworn in before testifying to the Senate Judiciary Committee confirmation hearing for Trump's Supreme Court nominee Judge Brett Kavanaugh) "The moment looks peaceful as if Christine Blasey Ford had closed her eyes in thought, but the image actually reflects the fact that in the nine seconds that she had her hand up to be sworn in to testify, she blinked several times. Blasey Ford began her testimony by saying: 'I am here today not because I want to be. I am terrified. I am here because I believe it is my civic duty to tell you what happened to me while Brett Kavanaugh and I were in high school.'" REUTERS/Jim Bourg SEARCH "TRUMP POY" FOR FOR THIS STORY. SEARCH "REUTERS POY" FOR ALL BEST OF 2018 PACKAGES. TPX IMAGES OF THE DAY. JIM BOURG Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (Supporters listen as President Trump speaks during a campaign rally in Montana) "As a White House photographer I'm always looking for a way to connect the President, Donald Trump, with a place. Before the mid-term elections Trump spent six days campaigning across the country, and at most of the rallies the visual elements were so similar that it was impossible to say whether we were in Florida or Alaska. In this case, though, the context was obvious. We arrived at a rally in Montana and I noticed a group of Native Americans wearing traditional headdresses behind the podium. For me this was the picture of the day." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (Trump meets with supporters from a group called "Bikers for Trump" at the Trump National Golf Club in New Jersey) "President Trump likes to be celebrated by supporters, and none better than a group known as "Bikers for Trump," who visited him at Trump National Golf Club in Bedminster, New Jersey, this summer. Unfortunately, it poured down that day and plans for an outdoor event gave way to a short visit inside the clubhouse for a group photo." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (A protester is removed during acting CIA Director Gina Haspel's testimony at her Senate Intelligence Committee confirmation hearing) "Just like sports, you have to follow the action. This time, I followed it out of the hearing room and into the hallway." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (President Trump speaks at the International Association of Chiefs of Police Annual Convention) "I took this photograph as the pool was being ushered out to leave right before Trump's speech was supposed to end. These are the images we take after we have taken the literal, newsy ones." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Kevin Lamarque (President Trump and Melania at the Flight 93 National Memorial) "A somber moment, this image came together because of the scale and symmetry of the wall panels and the people in the photo." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (US Secretary of State Mike Pompeo awaits the start of a news conference) "I always say that as photojournalists we photograph through the lens of the lives we live, including the books we read, the music we listen to, the movies we watch. As I was waiting for President Trump to arrive at an event one day, I noticed US Secretary of State Mike Pompeo standing right behind me in classic dark sunglasses. The image of John Belushi in the movie "The Blues Brothers" crossed my mind." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump speaks during the commemoration ceremony for Armistice Day at the Suresnes American Cemetery and Memorial in Paris) "During a recent visit to France and just days after a gunman opened fire at a Pittsburgh synagogue, President Trump visited a WWI cemetery to honor American soldiers. As he spoke, I noted a gravestone at a side angle Ã‘ a single Star of David in the middle of rows and rows of crosses. I felt in this moment, the image carried more meaning than the words." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (Alex van der Zwaan goes through security at the US District Court after arriving for his sentencing) "Everyone has to go through security, no matter who you are. He seemed to embrace the inevitable as the woman with the wand asked him to turn around, facing him back towards the doors where many of the news media were still gathered." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump speaks at a campaign rally in Missouri) "In a last push before the mid-term elections, President Trump traveled for six consecutive days, attending two or three rallies a day, to boost Republican candidates. Most of the rallies were held in airport hangars for an easy flight in and out. Sometimes, the rallies were held in the middle of the night, like this one at Columbia Regional Airport in Columbia, Missouri." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (President Trump holds his prepared questions as he hosts a listening session with high school students and teachers to discuss school safety at the White House) "This event was loaded with raw emotion as school shooting victims from across the country described their experience as student-survivors or as friends and family who never stop mourning dead children. President Trump was given a hand-written card by one of his aides to help him navigate the emotional meeting, and pictures of the card helped tell the story of the day." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Carlos Barria (President Trump behind the reflection of a House chamber railing as Trump delivers his State of the Union address to a joint session of the US Congress) "The State of the Union speech is one of the most important political events at the beginning of the year. We usually photograph it from several fixed positions, but this year I was assigned to be the 'rotating' photographer, meaning I could move around on the balcony and shoot from different angles, but only during short windows of time. During one of those windows, I found an interesting play of light reflected off a gold-colored railing, which, at a certain angle, could be seen to fall over the president." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Jonathan Ernst (President Trump arriving at Nashville International Airport) "One of my favorite photographers, Sam Abell, likes to quote his father: "Bad weather makes good pictures." In addition to the weather, the controlled chaos of White House press handlers and Secret Service agents help make pictures like this possible." Reuters President Trump: a year of high drama at home and abroad Reuters photographer Leah Millis (White House Communications Director Hope Hicks leaves after attending the House Intelligence Committee closed door meeting) "This is the product of about seven hours of waiting and lots of team work involving constant coordination to guess where to wait in order to capture Hope Hicks as she left the hill. Luckily, there were several cameramen along for the moment and their lighting captured her perfectly." Reuters

But when it was used as justification by Mr Trump to fire Mr Comey, Mr Rosenstein reportedly threatened to quit.

The president would later refer to “the Russia thing” as a reason for forcing out Mr Comey, who was overseeing the FBI when it was investigating potential links between the Trump campaign and Russia.

Days after Mr Comey’s dismissal, Mr Rosenstein would appoint Robert Mueller, the special counsel, to take over the FBI’s investigation – a decision that publicly infuriated Mr Trump.

Elsewhere in his book, Mr McCabe accuses Mr Trump of unleashing a “strain of insanity” into public life, and of having acted like a mobster when he allegedly offered to support Mr McCabe in return for loyalty.

Donald Trump's acting attorney general shuts down questions on Mueller probe: 'Your five minutes is up'

“The president and his men were trying to work me the way a criminal brigade would operate,” Mr McCabe writes of his brief period as acting FBI director, according to The Guardian.

Mr McCabe would later be fired – just 26 hours before he was scheduled to retire – by then-attorney general Jeff Sessions, who alleged Mr McCabe “made an unauthorized disclosure to the news media and lacked candor”.