Hillary Clinton was said to have been ecstatic when Donald Trump fired James Comey and had to be stopped by advisers from publicly praising the decision, according to a new book.

The former presidential candidate initially agreed with her rival's decision to fire the then FBI director, The Daily Beast reports.

Democrat Clinton was at her home in Chappaqua, New York when Comey lost the top job, according to new book, We've Got People: From Jesse Jackson to AOC, the End of Big Money and the Rise of a Movement.

Hillary Clinton, left, was said to have been ecstatic when Trump fired James Comey, right

Author Ryan Grim claims her initial response was down to Comey's reopening the investigation into her emails just days before the election.

Clinton previously has said that she thinks the letter Comey sent to Congress in October 2016, announcing that the FBI would be looking back at the email investigation, just 11 days before the election, killed her chances of winning.

In her own book, What Happened Clinton accused Comey of ‘shivving’ her.

Clinton is said to have thought Comey had 'finally gotten what he had coming' when Trump, pictured, fired him

She wrote that his public remarks about the email investigation opened the door for Trump to portray her as ‘Crooked Hillary.’

And she is said to have thought Comey had 'finally gotten what he had coming' when Trump fired him, according to the new book.

Grim writes: 'She had spent the winter and spring poring over survey and turnout data, calling friends and former aides relentlessly, analyzing and re-analyzing.

'It was, her friends believed, both part of her grieving process, but also holding her back from moving on.

'When she learned that Comey had been fired by Trump, she was ecstatic. Comey had finally gotten what he had coming.'

Comey was fired by Trump in May 2017 while he was leading the investigation into alleged meddling by the Russians in the 2016 US presidential election.

Trump's decision led to the appointment of special counsel Robert Mueller.

Comey was fired by Trump partly based on a memo written by Deputy Attorney General Rod Rosenstein.

Rosenstein faulted Comey for his handling of the Clinton email investigation.

One of Clinton's top campaign advisers and former spokesperson Brian Fallon said her team was unsure initially how to handle the news.

He said: 'In the immediate aftermath, people weren't sure how to respond. There were people who started buying into Trump's rationale.'

But Grim adds that Clinton was 'ultimately dissuaded by advisers from issuing a statement applauding the move'.

DailyMail.com has contacted a representative of Clinton for comment.