John Bercow says he will stand down as Commons Speaker and MP at the next election or on 31 October, whichever comes first.
Speaking in Parliament, Mr Bercow said his 10-year “tenure” was nearing its end and it had been the “greatest honour and privilege” to serve.
If there was no early election, he said 31 October would be the “least disruptive and most democratic” date.
The ex-Tory MP succeeded the late Michael Martin as Speaker in 2009.
He has faced fierce criticism from Brexiteers, who have questioned his impartiality on the issue of Europe and claim he has facilitated efforts by MPs opposed to a no-deal exit to take control of Commons business.
He has also been criticised for not doing more to tackle allegations of bullying and harassment in the House of Commons.
Mr Bercow himself has been accused of mistreating several members of his own staff, which he denies.
In a break from normal convention, Mr Bercow was facing a challenge from the Conservatives in his Buckingham constituency at the next election – whenever it is called.
His wife, Sally, was in the public gallery as he made his announcement – which comes just hours before Parliament is due to be suspended or prorogued for five weeks.
Mr Bercow said he had decided at the time of the 2017 election that this would his last Parliament as Speaker.
If MPs reject calls for an early election later on Monday, as seems likely, the Speaker said it was important an “experienced figure” chaired debates in the final week of October leading up to the UK’s possible exit from the EU.
The period between 14 October – when the Queen will open the new session of Parliament and the government announces its new legislative programme – and 31 October is likely to be among the most eventful and unpredictable in living memory.
Prime Minister Boris Johnson has said he will not ask for a further Brexit delay and the UK must leave the EU on Halloween.
But, unless he negotiates a new deal acceptable to Parliament, he will be legally obliged to seek a delay under the terms of legislation passed by MPs and which gained Royal Assent on Monday.
There has been speculation that, to avoid this, Mr Johnson could resign or force a vote of confidence which, if he lost, would trigger 14 days of negotiations over forming a new government.
Mr Bercow warned that if the appointment of his own successor was left until after the next election, newly-elected MPs might find themselves being “unduly influenced” by party whips in their choice of figure.
“It will mean a ballot is held when all members have some knowledge of the candidates. This is far preferable to a contest at the start of a Parliament where new MPs will not be similarly informed,” he told the Commons.
“We would not want anyone to be whipped senseless, would we?”
In an emotional speech, he said he had been proud to stand up for the interests of MPs and to act as the “backbenchers’ backstop”.
“Throughout my time as Speaker, I have sought to increase the relative authority of this legislature for which I will make absolutely no apology to anyone, anywhere, at any time.”
Mr Bercow received a standing ovation from the Labour benches after announcing his imminent departure, but most Tory MPs stayed in their seats.
Labour leader Jeremy Corbyn led tributes, saying the Speaker had stood up for and promoted democracy, adding that the “choice and timing” of his exit date was “incomparable”.
For the government, Michael Gove said his determination to give MPs increased opportunities to hold the government to account were “in the best tradition of Speakers”.
When he was first elected, Mr Bercow said he intended to serve no more than nine years in the job.
The Speaker is elected by all MPs in the House by secret ballot.
For many years, the role alternated between the two largest parties although this unwritten convention was broken in 2000 when Labour’s Michael Martin succeeded his colleague Betty Boothroyd.
Potential Labour successors to Mr Bercow include Commons deputy Speaker Lindsay Hoyle, Chris Bryant and Harriet Harman, the former Labour deputy leader and the longest-serving female MP in the House.
Conservatives Sir Edward Leigh and Eleanor Laing, who is also a deputy speaker, have also announced they will stand.