“What is the function of the civil service? To help the government implement its policies. But with Brexit – the most important constitutional issue for decades – every cabinet minister has his or her own policy. Without a written constitution and with only norms, traditions and precedents to guide us, this unprecedented situation has made everyone in government into a headless chicken.

“I was merely a humble vessel into which ministers, the people’s representatives, poured their thoughts and hopes. My job was to help turn this jumble into workable policies – no mean task. We were loyal to each government and each prime minister in turn, supporting their manifestos, their hopes and their dreams where practicable, whatever our private opinions.

Theresa May moves slowly and inflexibly sideways, stubborn as a crab

“But since Mr Cameron allowed his cabinet to campaign on both sides of that disastrous referendum, cabinet government has been defenestrated. There is no longer any collective policy. It is every man for himself, as we saw with Michael Gove, who said he was behind his fellow Brexiteer Boris Johnson and then stabbed him in the back. I have always been careful of people who say they are behind me because that’s where you need to be if you are going to stab them in the back. But none of them dare deliver the coup de grace to Mrs May because that may result in a general election.

“‘A dog’s obeyed in office,’ said King Lear. But not, sadly, Mrs May. Without even the extremely limited authority of a dog, she moves slowly and inflexibly sideways, stubborn as a crab. Never backwards, but never forwards. When I worked for prime minister Jim Hacker, I thought his government was scraping the bottom of the barrel. How wrong I was! Now I see that the barrel is bottomless. Mrs May was recently reduced to telling MPs that it is their ‘sacred duty’ to vote for her plan. If so, that would be a Church of England matter. Which plainly it is not.

Sir Ian McKellen in an RSC production of King Lear, 2008. Photograph: Channel 4

“So the question arises: whom should civil servants serve if their department’s secretary of state is not loyal to the prime minister? With the concept of collective responsibility out of style, is their loyalty to their secretary of state, the prime minister or (if it takes control next week) the House of Commons?

“Oliver Robbins, the former permanent secretary at the Department for Exiting the European Union, chose loyalty to Mrs May by becoming her adviser on Europe. Apparently he has been nicknamed ‘Sir Humphrey’, which is gratifying in that it suggests I am a legend within Whitehall. But – alas! – no one, not even young Olly, is either as charming or as Machiavellian as I.

“But here are some thoughts for him to consider. First, the Irish border: there are 300 potential crossing points. If we leave the EU without a customs agreement there will have to be border controls. It would only take one man taking a pot shot at a customs post to bring back soldiers, tanks, barbed wire, helicopters – and worse.

The leavers, English nationalists deluded by their own rhetoric, naturally gave little or no thought to Scotland or Ireland when they campaigned, and Karen Bradley, the current secretary of state for Northern Ireland, is such a know-nothing that when she was appointed she did not know that voters in Northern Ireland tend to vote on sectarian lines. Olly should encourage Mrs May to make a free-trade agreement for goods, which would make controls on the Irish border unnecessary. This would solve the biggest obstacle to Brexit. However, this would require some flexibility in Mrs May, a quality not yet revealed.

“We are told that parliament will try to take control. I’m not sure how that will help. On the BBC on Saturday morning I heard two parliamentarians (Lord Somebody and Lady Somebody Else) admitting that they couldn’t see a way through the various entrenched positions. We must avoid ‘no deal’, and the only option at this late stage is to achieve a dramatic shift in public opinion. This might be done by exploiting our traditional competitive attitude to the French.

“So I would discreetly phone Michel Barnier. He is French, and the Tories resent that we have never got our way with the French since the Battle of Waterloo. The chief of the defence staff once told me that we don’t have an independent nuclear deterrent because of the Russians – we have it because the French have one.

“I would ask Barnier to do two things:

1. Make it clear that the UK’s departure from the EU would also involve our being excluded from the Uefa League and Cup;

2. Clarify that we would also be excluded from the Eurovision song contest.

“These exclusions would greatly enhance the prospects of the French winning both in future.

“Then I would telephone President Macron and ask him to make a speech saying that De Gaulle had been right all along: the British are not to be trusted and should not have been admitted to Europe; that the French have been planning for years for us to depart and are delighted that they and the Germans will now be free to run things the way they want.

“With luck, this would so provoke the people that they would rise en masse and demand another referendum to stop the French from once more getting the better of us.”

• Jonathan Lynn was co-creator and co-writer of Yes Minister