Video report by ITV News Political Correspondent Paul Brand
Sajid Javid has said he was left with "no option" but to resign as chancellor after the prime minister insisted he replaced all his staff.
During Boris Johnson's Cabinet reshuffle Mr Javid was asked to stay in post, but on the condition he "replaced all" his political advisers.
"I don't believe any self-respecting minister would accept such conditions," he said.
Sajid Javid explains the reasons behind his resignation
It had been reported those conditions were being imposed by Boris Johnson's top aide Dominic Cummings, but Mr Javid said the demands were made by the prime minister himself."Those were the conditions requested by the prime minister, that was of course his prerogative".
He has been replaced by his former deputy, ex-chief secretary to the Treasury Rishi Sunak, who has gone from backbencher to chancellor in under five years.
Mr Javid's resignation came as a huge shock in Westminster, with Mr Javid's position being viewed as one of the safest.
He had already set a date to deliver his first budget on March 11.
He said it had been a "huge honour to serve as chancellor of the exchequer", adding how the prime minister and his successor had his full support.
Two days ago Mr Javid was asked about an alleged "power struggle" between him and Mr Johnson's top aide Mr Cummings.
Mr Javid told ITV News Business Editor Joel Hills not to "believe everything your read in the press" and denied there was tension.
By accepting the role of chancellor, it is believed Rishi Sunak accepted many of the conditions his predecessor rejected before resigning.
He said he was "delighted" to take on the role.
In December last year, Mr Sunak posted a photo to Twitter showing himself and Mr Javid in the cinema after watching Star Wars together.
He captioned the photo "great night out with the boss - Jedi Master".
Before the explosive meeting with Mr Johnson, Mr Javid had walked smiling into Number 10 in a sign that he expected to remain in place ahead of the March 11 Budget.
The Prime Minister's official spokesman said that preparations for the Budget would continue under the new Chancellor.
"Extensive preparations have already been carried out for the Budget and they will continue at pace," the spokesman said.
After resigning Mr Javid tweeted a letter addressed to the prime minister.
In it he said he regrets he could "not accept the conditions attached the the reappointment".
He told the Prime Minister he believed it was "important as leaders to have trusted teams that reflect the character and integrity that you would wish to be associated with".
It is "crucial" for ministers to have people around them who can "give clear and candid advice", he said.
He added: "I would urge you to ensure the Treasury as an institution retains as much credibility as possible.
"The team there has impressed me with the energy and intellect they have brought to delivering the shifts in policy that I have led."
Mr Javid's departure came after:
- Julian Smith was unceremoniously dumped as Northern Ireland secretary.
- Andrea Leadsom was sacked as business secretary.
- Theresa Villiers lost her job as environment secretary.
- Geoffrey Cox was sacked as attorney general
- Esther McVey lost her job as housing minister.
But along with the ministerial exits, the reshuffle - which Downing Street insiders had predicted would be "conventional" before the row with Mr Javid - saw promotions for MPs who are highly rated by Number 10.
Alok Sharma was promoted from international development to become the new Business Secretary and he will also be minister for the Cop26 UN climate summit.
Anne-Marie Trevelyan joins the Cabinet as International Development Secretary, having previously been a defence minister.
Oliver Dowden has become a full Cabinet member as Culture Secretary, having previously attended the meetings as paymaster general.
George Eustice was promoted to Environment Secretary from his previous role in the same department.
Brandon Lewis was appointed as Northern Ireland Secretary.
Former Brexit minister Suella Braverman returns to the Government as Attorney General.
Ex-Brexit secretary Stephen Barclay replaces Mr Sunak as Treasury Chief Secretary.
Former defence secretary Penny Mordaunt will return to Government as Paymaster General in the Cabinet Office, Number 10 announced.
Chris Skidmore was sacked as universities minister, saying he would have "more time to spend" with his family.
He tweeted: "Got a promotion in the #reshuffle to be a better Dad with more time to spend with this gorgeous little one.... Thanks everyone who I've had the chance to work with and the civil service teams that have supported me- you have all been amazing."
Other ministerial appointments include Christopher Pincher as a Minister of State in the Ministry of Housing, Communities and Local Government and Andrew Stephenson as a Minister of State in the Department for Transport.
Former party chairman James Cleverly has been appointed as joint Minister of State in the Foreign and Commonwealth Office and the Department for International Development.
Home Secretary Priti Patel, Foreign Secretary Dominic Raab, Chancellor of the Duchy of Lancaster Michael Gove, Justice Secretary Robert Buckland, International Trade Secretary Liz Truss and Health Secretary Matt Hancock were all confirmed in their existing roles.
Other ministers remaining in their posts include Work and Pensions Secretary Therese Coffey, Education Secretary Gavin Williamson, Housing Secretary Robert Jenrick, Transport Secretary Grant Shapps, Defence Secretary Ben Wallace, Scottish Secretary Alister Jack and Lords leader Baroness Evans of Bowes Park.