Lord O'Donnell said that it would take parliament" years and years" to separate fully from the EU, despite the UK's historic vote for Brexit in June.
O'Donnell was cabinet secretary - leading the civil service - from 2005 to 2011 and now sits in the House of Lords. Previously he also served as permanent secretary to the Treasury from 2002 to 2005.
"It very much depends what happens to public opinion and whether the EU changes before then," he told the Times.
"Lots of people will say 'we've had the referendum, we've decided to go out, so that's it, it's all over'
"It might be that the broader, more loosely aligned group is something that the UK is happy being a member of.
"While we can leave relatively quickly, what leaving means is a huge administrative and legislative change because of all of those rules and laws and directives that have been implemented over this last 40 years.
"My instinct is we will almost certainly stick with them and say 'OK, we'll keep them for now', so you can leave with everything in place."
The statements come months after the UK voted by a margin of 52 per cent to 48 per cent to leave the EU.
Labour leadership contender Owen Smith has pledged a second referendum on the issue once the details of Brexit have been ironed out, while Prime Minister Theresa May has maintained that "Brexit means Brexit".
O'Donnell added that May now has a very difficult job. "She's got to corral all these different individuals, come up with precisely what version of Brexit we want, what works best for the British people, and then go about implementing it," he said.