British finance minister Philip Hammond has resigned from the country's government, following through on a promise to leave rather than serve under incoming prime minister Boris Johnson.

Mr Hammond - who strongly opposes leaving the European Union without a deal - said the new prime minister should be "free to choose a chancellor who is fully aligned with his policy position". 

Mr Johnson has repeatedly promised to take the UK out of the European Union on October 31, with or without a deal. 

In his resignation letter to Theresa May, Mr Hammond said: "Despite the uncertainty created by the unresolved issue of Brexit, we have been able to make notable progress in rebuilding the public finances and preparing the British economy for the opportunities ahead." 

In a pointed message to Mr Johnson, the outgoing Chancellor warned that the headroom built up in the public finances could only be used for tax cuts and spending boosts if a Brexit deal was secured. 

In his letter to Mrs May, ahead of her own resignation as prime minister, he said: "We bequeath to our successors genuine choices, once a Brexit deal is done: the ability to choose, within the fiscal rules, between increased public spending, reduced taxes, higher investment or progress towards faster debt reduction - or some combination of all four. 

"After a decade when the aftermath of the 2008-09 recession meant we had no choices, this is a luxury which our successors should use wisely," he added. 

PA understands Mr Hammond handed his resignation to Mrs May after her final session of Prime Minister's Questions. 

Given their differences over Brexit, it is highly unlikely he would have been given a job by Mr Johnson even if he had wished to carry on.

Mr Johnson has said he wants ministers who are prepared if necessary to leave the EU without a deal with Brussels.