Tony Blair has defended his record as prime minister and told union members the "brutal truth" is that government is a "hard and difficult business".
But Mr Blair, who was heckled in what was his last speech to the TUC as PM, said it was a "darn sight better than wasting our time in opposition".
They may have disagreed sometimes, he said, but there had been great progress in health, education and pensions.
He spoke after some RMT union members walked out shouting for him to go.
Other people waved banners in protest at the involvement of British troops in Iraq and Afghanistan, while comments about schools prompted shouts of "rubbish".
'Courage and determination'
After giving his final speech on the challenges of globalisation, Mr Blair was asked to look back over his time as prime minister.
As he walked across the front of the platform, he said: "I am not saying that everything has been good, because it hasn't.
"And incidentally, for those of you who think that you will ever get a government where everything is fine, that doesn't happen.
"What does happen is progress, if we have the courage and the determination to remain in government."
He said Labour could only continue in government if it focuses on policy for the future and "accepts that government is a hard, difficult business".
'Making a difference'
"But it is a darn sight better than wasting our time in opposition passing resolutions no-one ever listens to or can do anything about.
"That is the brutal truth ... You have your difficult times and you have your better times and the decisions you take are often very, very hard to take, but actually it's a privilege to take them.
"And the reason for that is, just occasionally, you meet people - and I do in different parts of the country - whose lives we have changed."
Mr Blair, who said he believed Britain was a more "decent society" than a decade ago, has angered some unions by what they see as public service "privatisation".
As RMT leader Bob Crow led a delegation out of the Brighton Centre in protest, he said: "What is the point of listening to someone when you cannot believe a word they say?"
As protesters jeered, the prime minister told them they were entitled to their views but were playing into the hands of those hostile to a Labour government.
In his speech, he argued that the UK must respond to people's anxieties on mass immigration and terrorism while keeping the values of tolerance and respect for others.
As he explained that a large part of the Western world were inclined to believe "the threat is George Bush and not Islamist terrorism", a number of delegates shouted: "Yes."
Some jeered "troops out", to which Mr Blair replied angrily: "We should be proud of what we are doing to support democrats in Iraq and are proud of it."
He also said the delegates should be proud that it was because of the support of trade unions in this country, both Iraq and Afghanistan now had trade union rights for the first time.
"You can hold up your posters about troops out but the reason troops are in is because the democratic governments of Iraq and Afghanistan need our troops to protect their people against the Taleban and al Qaeda."
He pressed the case for ID cards, saying that they were necessary to deal with mass immigration and the growth of identity fraud.
And he said claims that the government was privatising the health service were wrong because there were now quarter of a million more public sector workers in the NHS than there were when Labour came to power.
Chancellor Gordon Brown, tipped as Mr Blair's most likely successor, later condemned those who walked out.
And in a private dinner with union chiefs, he said he supported everything the outgoing prime minister had said and backed his controversial NHS reforms.
Mr Blair has said he will stand down as prime minister within the next year.
With speculation over the timing of his departure continuing, Mr Brown received the backing of Northern Ireland Secretary Peter Hain during a fringe meeting at the Brighton conference.
Mr Hain, who said he would stand to succeed John Prescott as deputy leader, said he did not think anybody "could or should" beat Mr Brown.
Mr Hain's move was in contrast to Environment Secretary David Miliband, who ruled himself out of the running for either of the top posts during his speech to the TUC on Tuesday morning.
On Monday, the TUC attacked Mr Blair's reform agenda on public services, in particular moves to hive off services to private firms, and voiced concerns about the government's pensions policy.
Union members make-up 33% of the votes in choosing the next Labour leader.