The stark consequences of a no-deal Brexit were laid bare for Michael Gove at a roundtable meeting with representatives from the food industry last month. There was no sugarcoating it: Mars bars could run out within weeks if the UK left the EU without a deal.

According to an industry insider present, the environment secretary was left reeling by a briefing from the Food and Drink Federation that of the 21 ingredients that make up a Mars bar manufactured at their factory in Slough, two imported products go off within a few days.

In the event of no deal, gridlock at the port of Dover would effectively shut down one of the country’s main routes for food imports. The ingredients couldn’t be stockpiled. The experts told Gove the UK’s entire supply of Mars bars would run out within two weeks.

The striking case study helps explains the former Vote Leave campaigner’s decision to stay in the government on Friday.

Allies of Gove told BuzzFeed News that, despite warmly backing the deal at cabinet on Wednesday, he privately loathes the agreement Theresa May has made with Brussels. But, they said, his experience running the Department for Environment and Rural Affairs had convinced him that the alternative of no deal was unconscionable.

According to a person who has been briefed on DEFRA’s internal discussions on no deal, officials are forecasting that the disruption to food imports and exports could last for more than six months, leading to shortages on supermarket shelves and putting enormous financial pressure on businesses that depend on exports to the EU.

“The other Brexiteers in the cabinet and a lot of those on the backbenches would go for no deal,” said one friend of Gove. “But Michael would never, because he has seen what it means in DEFRA.”

A second source familiar with his thinking said he did not want to be the person who brought down May and put the country on course for a no-deal Brexit that he would then be blamed for.

Gove’s decision to remain in post sent shockwaves through the Brexiteer ranks and led many in Westminster to conclude he had saved the prime minister, for now.