text: Lord O'Donnell told the Times it would take Parliament "years and years and years" to separate fully from Brussels.
  "It very much depends what happens to public opinion and whether the EU changes before then," he said.
  He later told the BBC he did not think the EU would make the radical changes needed for the UK to remain a member.
  As Gus O'Donnell, he was cabinet secretary from 2005 to 2011 and is now a crossbencher in the House of Lords.
  Lord O'Donnell 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."
  Asked about these comments, he told BBC Radio 4 this was an example of a "low-probability event that might mean we don't leave".
  He also said his "central assumption" was that the EU would not radically change.
  "The probability of us not leaving is very, very low and we need to get on and implement the people's decision," he added.
  Lord O'Donnell said making Brexit happen would be difficult, partly because article 50 of the Lisbon Treaty - the step required to officially begin the process - was designed "in a way that is very strongly in favour of those who are staying, not the leaving party".
  He said he "wouldn't be in a rush" to trigger article 50, as the government must first work out a "strategic plan to say 'what kind of UK do we want, what's our place in the world, what are we trying to achieve in these negotiations'".
  Handling Brexit would be an "unprecedented challenge" for the government and the civil service, he added.
  In his interview in the Times, Lord O'Donnell said Theresa May - who replaced David Cameron as prime minister after the UK public voted by 52% to 48% to leave the EU - now faced a "really 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.
  He said he was "not a big fan of referenda", adding that there were "ridiculous claims" on both sides in the UK's debate on EU membership.
  Mrs May has said formal talks on Britain's "sensible and orderly departure" from the EU will not begin until next year - but she has been clear that "Brexit means Brexit".
  Gus O'Donnell served as a press secretary under John Major, and then as cabinet secretary - the UK's most senior civil servant - in the cabinets of Tony Blair, Gordon Brown and David Cameron.
target: A former head of the civil service has said the UK might remain in a "more loosely aligned" European Union, despite the referendum vote to leave.