Lord Simon McDonald, the former top civil servant at the Foreign Office, has admitted revealing to ministers and colleagues that he voted to remain in the European Union.
The peer said he was speaking to colleagues shocked at the result of the Brexit referendum, despite the Civil Service code demanding “impartiality”.
He made the admission in a documentary by the BBC’s Laura Kuenssberg on the chaos that has reigned in UK politics since 2016.
The show airing on Monday also confirms conversations within the government suggesting former deputy prime minister Sir David Lidington could have replaced Theresa May in No 10 to offer a second referendum on leaving the EU.
Lord McDonald is a controversial character among some Tory Brexiteers and played a role in the downfall of Boris Johnson after leaving office.
He told the BBC the main feeling in the Foreign Office after the 2016 referendum was of “mourning”, adding: “People were in tears. People were in shock.
“On this occasion, this solitary occasion, I decided to tell my colleagues and therefore let ministers know that I voted to remain in the European Union.”
Lord McDonald, who was the Foreign Office’s permanent secretary between 2015 and 2020, said he believed colleagues knew his position anyway.
“I was trying to maintain credibility and trying to convey a message to a group of people, most of whom I felt had voted to remain in the EU, that their personal feelings were beside the professional point,” he added.
He acknowledged that the Foreign Office board was “not entirely comfortable” with the move.
Former deputy cabinet secretary Helen MacNamara responded: “Wow… I don’t know why that would be a good or helpful thing.”
The code for civil servants requires they act with impartiality by never allowing “personal political views to determine any advice you give or your actions”.
Lord McDonald played a role in Mr Johnson’s downfall as prime minister by revealing the Tory had been warned about a complaint against Chris Pincher before appointing him as a party whip.
Later in the documentary, Sir David confirms that the possibility of him taking over as prime minister to call a second referendum had been discussed as Mrs May struggled to get her Brexit deal through Parliament.
“Yes, that was what happened,” he said, before downplaying the likelihood of it happening.
“Theresa was not going to go, that was very clear. And I certainly never made any suggestion to her or made any move against her. I would not have done so.”
Laura Kuenssberg: State Of Chaos is being broadcast on BBC2 at 9pm.
The headline of this article was amended on the day of publication. It originally said Lord McDonald voted for Brexit but that was inaccurate. As the article itself makes makes clear, Lord McDonald voted for the UK to remain within the EU.