Labour today returned to outright control of Glasgow, Scotland’s largest council, ending SNP hopes of a spectacular power grab, although the Nationalists did achieve significant results elsewhere.

The Nationalists needed to win 40 seats to replace Labour in a majority administration which, apart from a recent hiccup, it has held for around four decades. But shortly after 5pm, Labour reached 44 seats to ensure majority rule in a result which proved a relief and a fillip in almost equal measure for the party.

With all 79 seats declared, Labour had taken 44, against the SNP's 27, with the Greens now the third biggest group at the City Chambers, on five seats. Independent Glasgow First candidate Stephen Dornan completed the list, along with sole Tory David Meikle and solitary LibDem Margot Clark.

Gordon Matheson, who led the council for Labour, hit back at the Nationalists who had considered Scotland's largest city a key target, one year on from their unprecedented majority win at the Scottish Parliament. He said: "So far the results have been very good for Labour and extraordinarily bad for the SNP. Their juggernaut has rolled into a ditch.

"They were the party that made big predictions that they would sweep Labour from power. The people of Glasgow have had other ideas. I'm not making final predictions about the outcome because there are a number of seats to declare. I'll be absolutely clear about this: if Labour does emerge as the largest party, I would be seeking to form the administration and lead Glasgow City Council through the Commonwealth Games and beyond."

Scottish Labour leader Johann Lamont, who joined the Glasgow count in the afternoon, said the results showed the SNP drive for independence has failed to resonate with voters at council level and were a "strong message" for the Scottish Government.

"It's about, in tough times, making sure we have people on their side, fighting for jobs, fighting to make sure we have the best quality services we can get."

She added: "If last year was a tsunami for the SNP, perhaps now the tide is going out on Alex Salmond."

It was the first electoral test for Ms Lamont since becoming overall leader of the party in Scotland late last year. In the run-up to the council election, she said the SNP were likely to do better this year, and played down her own party's chances of securing victory in Glasgow.

Gail Sheridan, wife of former MSP Tommy, failed in her bid to take a seat on the council for Solidarity, missing out to two Labour and two SNP candidates in the Cardonald and Craigton ward.

Mr Sheridan, who was jailed for perjury, said First Minister Alex Salmond's relationship with media tycoon Rupert Murdoch had turned voters away from the SNP in Glasgow. Mr Sheridan said: "The SNP's bandwagon has maybe stuttered here. Mr Salmond's relationship with Mr Murdoch has got something to do with it."

Elsewhere in Scotland, Labour held on to majority rule in their other west of Scotland stronghold, North Lanarkshire, and reclaimed Renfrewshire, but the SNP recorded some notable successes, including their first majority administrations, in Dundee and Angus.

In Dundee, where the party previously ran a minority administration, every one of the 16 candidates the Nationalists put forward were elected, as were 10 Labour councillors, with one Tory, one Lib Dem and one independent also voted in.

The SNP also gained a majority on Angus Council, with 15 councillors elected, alongside eight independents, four Tories, one Labour representative and one Liberal Democrat.

Joe FitzPatrick, SNP MSP for Dundee West, said: "This truly is historic for the SNP in Dundee. I am absolutely thrilled that my home city has voted clearly to become an SNP city. In 2007 the SNP held no majorities. I am pleased Angus and Dundee have delivered the first two majority administrations for the SNP."

Graeme Day, Nationalist MSP for Angus South, said he was "absolutely delighted" with the result. He added: "We took nothing for granted in this election and worked hard for every vote. Our positive message based around jobs and families went down well on the doorsteps."

SNP campaign director Derek Mackay said the Nationalists were making gains all over Scotland. Mr Mackay said: "In stark contrast to the situation south of the border, where the governing parties are suffering big losses to the opposition, the SNP are making gains from all parties and we are actually increasing our share of the vote. We are the largest party in a number of councils, and are on course to secure many more seats as the afternoon progresses.

"Our ambition in standing significantly more candidates, where everyone else chose to stand fewer, appears to be paying off as voters turn out to support us the length and breadth of Scotland."

The scale of the LibDem collapse was most marked in Edinburgh, where the party appeared to have been heavily punished for its role over the trams debacle in the previous coalition with the SNP.

Jenny Dawe, the group leader, lost her seat, along with 12 other colleagues, to leave the LibDems with a rump of only three on the 58-seat council.  The Greens were the biggest beneficiary of their downturn and their six councillorscould have a key role in forming a new coalition. The final make-up in Edinburgh is Lab 20, SNP 18, C 11, Green 6, LD 3.

        

Pentland Hills Lib Dem candidate Stuart Bridges even came behind an independent climate activist who visits schools dressed as a penguin and who registered just four weeks ago as Mike "Professor Pongoo" Ferrigan.

The main issue in Edinburgh was clear in the spoiled ballots, many of which featured the word "trams" in opposition to the council's controversial transport scheme. Edinburgh's trams are running over-time and massively over-budget following a prolonged dispute between the council and the project's main contractor.

Meanwhile, the Tories had the most councillors elected in South Ayrshire. Previously running a minority administration in the authority, they had 10 members voted into office there, putting them narrowly ahead of Labour and the SNP, who both had nine councillors elected. Two independent councillors were also voted in.

Stirling was one of the first councils in Scotland to declare results in full. The SNP now has nine councillors, up by two, and Labour remains on eight. Four Conservative councillors were elected, the same as before, and one Green was voted in. Three Liberal Democrats were elected in 2007 but the party now has no councillors in the local authority.

Inverclyde Council has also returned all of its councillors, with Labour winning half of the authority's elected representatives. It now has 10 councillors, compared with six for the SNP, two for the Liberal Democrats and one for the Tories. One independent councillor was also elected.

In Clackmannanshire - Scotland's smallest local authority - both Labour and the SNP had eight councillors voted in. Voters also elected one Conservative councillor and one independent.

In Fife, Jim Leishman, director of football at Dunfermline Athletic, was elected as a Labour councillor. He won 1,608 first-preference votes in the Dunfermline Central ward, the largest number of any of the candidates there. The former professional footballer was backed by former Prime Minister Gordon Brown and former First Minister Henry McLeish in his campaign.

The first Green councillor elected north of the border was former MSP Mark Ruskell, voted into the Dunblane and Bridge of Allan ward of Stirling Council.

A total of 1,223 seats were up for grabs, with the single transferable vote system being used to elect councillors and electronic counting used to determine the winners.