Media playback is unsupported on your device Media caption Ed Miliband: ''Labour is taking nothing for granted''

Ed Miliband has told voters Labour are "back throughout the country on your side" after making big gains in the English, Welsh and Scottish elections.

In Scotland they gained a majority in Glasgow, while in Wales their results were the best since 1996 and in England they gained 22 councils.

Overall Labour gained 823 councillors. The Tories lost 405 and Lib Dems 336.

But Prime Minister David Cameron said he would continue making "difficult decisions" to deal with the deficit.

With all the results in, the BBC's projection of the national share of the vote has Labour with a 38% national share of the vote, up three points, with the Tories down four on 31%.

The Lib Dems' projected national share of the vote is estimated to be unchanged at 16%. But the party's total number of councillors has dipped below 3,000 for the first time since it was formed in 1988.

In other developments:

Conservative ministers have shrugged off the results as typical for a mid-term government.

Addressing activists in Southampton, one of the key councils gained by Labour, Mr Miliband said his party's campaign had been based around "the things that matter to people" - attacking the coalition as "out of touch".

His party took control of series of key councils in the south-east of England and the Midlands, including Birmingham, Plymouth, Reading, Norwich, Thurrock and Harlow.

"For the parents worried about their son or daughter who can't find a job, for the people who are seeing their living standards squeezed, for the people who think this country only works for a few at the top and not for them - Labour is back on your side. Labour is back in the south of England on your side, Labour is back throughout the country on your side."

He pledged to reach out to those who did not turn out to vote and to "regain trust", following the party's 2010 general election defeat, saying Labour still had "more to do" to win people over.

The people have spoken. The question now is - what exactly were they saying?

Shortly after his speech the Labour leader was hit on the shoulder by an egg during a walkabout in Southampton.

Prime Minister David Cameron said he was sorry for the councillors who had lost their seats against "a difficult national backdrop" but rejected suggestions he should change course: "These are difficult times and there aren't easy answers.

"What we have to do is take the difficult decisions to deal with the debt, deficit and broken economy that we've inherited and we will go on making those decisions and we've got to do the right thing for our country."

In London Conservative Boris Johnson pipped Labour's Ken Livingstone to win a second term as London mayor, although Labour made gains in the London assembly.

In Scotland - where Labour had been under pressure from the Scottish National Party - Labour gained 58 councillors, the SNP gained 57 with the Lib Dems the biggest losers, with 80 of their councillors defeated.

Deputy Prime Minister and Lib Dem leader Nick Clegg said he was "really sad" that so many Lib Dem councillors had lost their seats but added: "I am determined that we will continue to play our role in rescuing, repairing and reforming the British economy.

"It's not an easy job and it can't be done overnight but our duty is to boost jobs and investment and to restore a sense of hope and optimism to our country."

Overall picture Projected national share: Labour 38%, Tories 31%, Lib Dems 16%

Nine cities have rejected calls for an elected mayor, while one, Bristol, has voted "yes"

Labour and SNP make big gains in Scotland, Lib Dems lose

In Wales Labour had their best results since 1996, with Plaid Cymru, Lib Dems and Conservatives all suffering

The UK Independence Party increased its vote share, averaging about 13% of the vote where their candidates were standing, although it failed to translate that into seats - gaining six but losing five.

Backbench Conservative MP Gary Streeter said Conservative supporters were sending a message to Mr Cameron that "they don't think our leadership is Conservative enough" by voting for the Eurosceptic UKIP.

But Foreign Secretary William Hague rejected any move to the right or left for the government and Lib Dem president Tim Farron told BBC any "lurch to the right" by the Tories would be "bonkers".

More than 4,700 seats have been contested in 128 English councils, with 21 unitary authorities in Wales electing new councillors. In Scotland, every seat on 32 unitary authorities was up for election.

Voters in Birmingham, Manchester, Sheffield, Nottingham, Newcastle-upon-Tyne, Coventry, Wakefield, Leeds and Bradford have voted "no" in referendums for elected mayors but Bristol has voted "yes". In Doncaster, residents have voted to keep their mayoral system.

· All the latest election results are available at bbc.co.uk/vote2012