The UK’s ambassador to the EU, Sir Ivan Rogers, has resigned.
Sir Ivan, appointed to the job by David Cameron in 2013, had been expected to play a key role in Brexit talks expected to start within months.
The government said Sir Ivan had quit early so a successor could be in place before negotiations start.
Last month the BBC revealed he had privately told ministers a UK-EU trade deal might take 10 years to finalise, sparking criticism from some MPs.
He told them this was also the view of the EU’s other 27 member states.
Ministers have said a deal can be done within two years.
BBC Brussels correspondent Kevin Connolly said it appeared there had been “some failure of synchronisation” between Sir Ivan – who had been due to leave his post in November- and the UK government.
A government spokeswoman said: “Sir Ivan Rogers has resigned a few months early as UK permanent representative to the European Union.
“Sir Ivan has taken this decision now to enable a successor to be appointed before the UK invokes Article 50 by the end of March. We are grateful for his work and commitment over the last three years.”
Prime Minister Theresa May says she will trigger formal talks between the UK and the EU by the end of March, setting in place a two-year negotiation process.
Sir Ivan is a veteran civil servant whose previous roles include private secretary to ex-chancellor Ken Clarke, principal private secretary to ex-PM Tony Blair and Mr Cameron’s Europe adviser.
He was criticised in some quarters for “pessimism” over Brexit after his advice to ministers on the negotiating timescale was reported.
Pro-EU figures raised concern about the impact of Sir Ivan’s departure, while Brexit campaigners welcomed his decision. Former Lib Dem leader Nick Clegg, who once worked for Sir Ivan in Brussels, described his resignation as a “body blow to the government’s Brexit plans”.
He added: “If the reports are true that he has been hounded out by hostile Brexiteers in government, it counts as a spectacular own goal.”
Labour MP Hilary Benn, who chairs the Brexit select committee, said it had come at a “crucial” point and urged the government to “get its skates on” in finding a replacement. “It couldn’t be a more difficult time to organise a handover,” he added.
Mr Benn told BBC Radio 4’s The World at One the permanent representative’s job was to convey the view of the UK to other member states, as well as “honestly and fearlessly reporting back” what those countries in turn said about the negotiations.
But former Conservative cabinet minister John Redwood said Sir Ivan had made a “very wise decision”, saying his leaked advice suggested he did “not really have his heart in” Brexit, believing it to be “very difficult and long-winded”.
He said the new ambassador should be someone “who thinks it’s straightforward”.
Former UKIP leader Nigel Farage said he welcomed Sir Ivan’s resignation, adding: “The Foreign Office needs a complete clear-out.”
But former chancellor George Osborne said Sir Ivan was a “perceptive, pragmatic and patriotic public servant” while the Treasury’s former top civil servant, Lord Macpherson – who is now a crossbench peer – said his departure marked a “wilful” and “total destruction” of EU expertise within Whitehall.