Philip Hammond has said he will quit as chancellor if Boris Johnson becomes prime minister and he would not hang on “to be sacked”.

“I intend to resign after prime minister’s questions [on Wednesday], before the prime minister goes to the palace,” he said.

The chancellor – a staunch opponent of a no-deal Brexit – also vowed to help lead the Commons campaign to block it, from the back benches, and predicted success.

“I am confident that parliament does have a way of preventing a no-deal exit on 31 October without parliamentary consent,” he told the BBC’s Andrew Marr Show.

“I intend to work with others to ensure parliament uses its power to make sure the new government can’t do that,” Mr Hammond threatened.

Mr Johnson, the near-certain next prime minister, has vowed a “do or die Brexit” on Halloween, without an agreement if the EU refuses to budge on the Irish backstop.

Put It To The People march: Best of The Independent’s pictures Show all 24 1 /24 Put It To The People march: Best of The Independent’s pictures Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent Put It To The People march: Best of The Independent’s pictures Put It To The People protest 23 March 2019 Angela Christofilou/The Independent Angela Christofilou/The Independent

It was already certain that Mr Hammond, who has been in No 11 for three years, would leave the government if the frontrunner wins the race when the result is declared on Tuesday.

Asked if he thought he would be sacked, he replied: “No, I’m sure I’m not going to be sacked because I’m going to resign before we get to that point.

“Assuming that Boris Johnson becomes the next prime minister, I understand that his conditions for serving in his government would include accepting a no-deal exit on the 31 October, and it’s not something that I could ever sign up to.

“It’s very important that the prime minister is able to have a chancellor who is closely aligned with him in terms of policy, and I therefore intend to resign to Theresa May before she goes to the palace to tender her own resignation on Wednesday.”

The move comes after David Gauke, the justice secretary and another no-deal opponent, revealed he would also quit on Wednesday if Mr Johnson reaches Downing Street.

Mr Gauke said: “Given that I’ve been in the cabinet since Theresa May came to power, I think the appropriate thing is for me to resign to her.”

Other pro-EU cabinet ministers – such as de-facto deputy prime minister David Lidington and Greg Clark, the business secretary – are also expected to quit or be sacked.

The Independent revealed today that Mr Johnson is considering a shock return as home secretary for Priti Patel, with Iain Duncan Smith earmarked as chief whip.

Mr Hammond has previously hinted he would join a vote of no confidence to topple Mr Johnson if necessary, but told the programme: “I don’t think it will get to that.”