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 blessed" 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.
Mr Brown, who is expected to launch his leadership campaign on Friday, paid tribute to Mr Blair, saying: "I think I spoke for millions when I said at Cabinet today that Tony Blair's achievements are unique, unprecedented and enduring."
He said people would remember "how he led the country after 7 July, how he responded for the world after 11 September in America, how he responded to the tragic death of Princess Diana".
He said Mr Blair's legacy would also be better public services and a strong economy adding "Britain's reputation in the world is stronger than ever before. At all times he tried to do the right thing".
US President George W Bush said he would "miss" Mr Blair.
"He is a political figure who is capable of thinking over the horizon. He's a long-term thinker," said Mr Bush.
"I have found him to be a man who's kept his word which is sometimes rare in the political circles I run in."
Earlier, 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".
It was for others to judge whether he had made mistakes, said Mr Blair, adding: "I have always done what I thought was right."
He said expectations had probably been "too high" in 1997, but he defended his government's record in office.
"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," he said.
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 support America's invasion of Iraq.
"I did what I thought was right for our country," Mr Blair said, summing up his record.
"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 election agent John Burton and wife Cherie.
He has now arrived back in Downing Street after flying back to London.
Labour is later expected to announce a special party conference on 24 June to unveil its next leader.
Giving his reaction to Mr Blair's speech on his website, Conservative leader David Cameron said: "I think a lot of people will look back on the last 10 years of dashed hopes and big disappointments, of so much promised so little delivered."
Mr Cameron has said the country faces seven weeks of "paralysis" until Labour chooses a new top team, accusing Mr Blair of running a government of the "living dead".
Lib Dem leader Sir Menzies Campbell said he thought Mr Blair's speech was "defensive, defiant, and even chauvinist at the end talking about Great Britain as being the best country in the world".
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.
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 met on Thursday as planned to see who had the most support, with the idea that the one with the least support stepping aside.
However a press conference after that meeting was cancelled, with the two saying their numbers of backers were "too close to call" and further clarification were needed, with a decision postponed to Monday.
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.
The Liberal Democrats have, meanwhile, tabled a Parliamentary motion urging the Queen to dissolve parliament and call a general election.