Tony Blair has announced he will stand down as prime minister on 27 June.
He made the announcement in a speech to party activists in his Sedgefield constituency, after earlier briefing the Cabinet on his plans.
He acknowledged his government had not always lived up to high expectations but said he had been very lucky to lead “the greatest nation on earth”.
He will stay on in Downing Street until the Labour Party elects a new leader – widely expected to be Gordon Brown, reports BBC news online.
In an emotional speech, Mr Blair said he had been prime minister for 10 years which was “long enough” for the country and himself.
He thanked the British people for their support and apologised for when “I have fallen short”.
He said expectations had probably been “too high” in 1997, but he insisted living standards had improved under Labour.
“There is only one government since 1945 that can say all of the following: more jobs, fewer unemployed, better health and education results, lower crime and economic growth in every quarter. Only one government, this one.”
On foreign policy, Mr Blair acknowledged the terrorist “blow back” from the “bitterly controversial” invasion of Iraq and Afghanistan and he urged Britain to stay the course in the fight against terror.
“I decided we should stand shoulder to shoulder with our oldest ally, and I did so out of belief,” he said of his decision to back the war in Iraq.
It was for others to judge whether he had made mistakes, he added, but said he had always done what he thought was “right”.
“I may have been wrong. That’s your call.
“But believe one thing if nothing else, I did what I thought was right for our country. And I came into office with high hopes for Britain’s future, and, you know, I leave it with even higher hopes for Britain’s future.”
In conclusion, he said: “Actually I’ve been lucky and very blessed. And this country is a blessed nation.
“The British are special – the world knows it, in our innermost thoughts we know it. This is the greatest nation on earth.”
Mr Blair was given a standing ovation by around 250 Labour activists and members who had crammed into the tiny bar of Trimdon Labour Club to see him off.
Waving hand-written placards reading “Sedgefield Loves Tony”, “10 Great Years”, “Thank You” and “Britain is Better”, the crowd cheered as Mr Blair embraced his agent John Burton and wife Cherie.
Earlier, Gordon Brown paid tribute to Mr Blair’s leadership, praising “his unique achievement over 10 years and the unique leadership he had given to the party, Britain and the world”.
His comments were greeted by “much thumping of tables” by Cabinet colleagues, the prime minister’s official spokesman told reporters.
Northern Ireland Secretary Peter Hain said it had been a “cordial, comradely” meeting with “quite a lot of laughter” and “leg-pulling”.
Mr Hain, who is a candidate for Labour’s deputy leadership, said Mr Brown would now “take up Tony Blair’s mantle in the next period of our government”.
Mr Blair’s election agent and close friend John Burton said he expected Mr Blair to continue as Sedgefield’s MP until the next general election, unless he was offered a major international job.
Former Cabinet minister and Blair ally Alan Milburn said thought the prime minister “slightly regretted pre-announcing his retirement” by saying he would not seek a fourth term.
“I think he would have preferred to stay longer,” added Mr Milburn but he said the prime minister had had “a good 10 years” and had “fundamentally changed the country for the better”.
Mr Blair’s official spokesman insists he will remain “focused” on being prime minister until Labour has chosen his successor – a process expected to last seven weeks.
He said Mr Blair still has lots of work to do on domestic issues and had a number of international commitments in the run-up to this summer’s G8 and EU summits.
But with a new prime minister expected to be in place by the beginning of July, attention at Westminster has already shifted to his succession.
Mr Brown is unlikely to face a Cabinet-level challenge for the leadership as all of the likely contenders have ruled themselves out.
But he could still face a challenge from one of two left wing backbenchers – John McDonnell and Michael Meacher. The pair are meeting later to see if one of them can muster enough support to get on to the ballot paper.
Candidates need the signatures of 45 Labour MPs to enter a contest.
Shortly after Mr Blair’s announcement, the deputy prime minister and deputy Labour leader John Prescott also announced his intention to stand down.
Six deputy leadership hopefuls are already battling for nominations to enter the race to replace Mr Prescott.
Conservative leader David Cameron has said the country faces seven weeks of “paralysis” until Labour chooses a new leader, accusing Mr Blair of running a government of the “living dead”.
The Liberal Democrats have, meanwhile, tabled a Parliamentary motion urging the Queen to dissolve parliament and call a general election.
But European Union Trade Commissioner and close Blair ally, Peter Mandelson, denied that Mr Blair’s last weeks in office would be as a lame duck leader.
“He’s going of his own choice. He’s doing it at a time which he thinks is good for the country, is good for the government.”