THE SNP has won the most seats in the Holyrood election beating Labour by just a single seat - and leader Alex Salmond seemed to crown himself First Minister of Scotland before all the votes were even counted.

THE SNP has won the most seats in the Holyrood election beating Labour by just a single seat - and leader Alex Salmond seemed to crown himself First Minister of Scotland before all the votes were even counted.

But whether his party will get enough support from other parties to form a coalition and govern the country remains unclear.

SEE HOW SCOTLAND IS SHAPING UP ON OUR INTERACTIVE ELECTION MAP

So... what went wrong?

An urgent investigation is to be launched into the election problems.

The new method of counting votes alongside a new council voting system was meant to take Scotland into a new era of modern voting. But instead there has been chaos and delay.

WHAT WAS MEANT TO HAPPEN? For the first time, electronic counting machines were used. Votes were cast in the usual way, but the papers were scanned electronically, then counted.

WHAT ELSE WAS NEW? The council elections were conducted for the first time in Scotland by the single transferable vote - STV - which requires voters to choose their three or four favoured candidates, ranking them through 1,2,3 and 4.

WHY? Because the LibDems insisted on it as they believe it more accurately reflects voters' wishes. Labour needed their votes in coalition, although many in Labour's ranks loathed the idea, for a range of reasons.

WHAT WENT WRONG? There were delays with sending some postal votes out which some people complained left themdisenfranchised.

Then there were glitches in the final stage of processing the counted votes. This led to the big delays.

Separately from all this, huge numbers of ballot papers - possibly as many as 100,000 - were deemed invalid because the voters' intentions were not clear.

WHAT HAPPENS NOW? The Electoral Commission is to investigate.

WHAT DOES THE COMPANY SAY? Sonya Anderson, head of elections at DRS, said: "The e-counting system did not crash. The system remained secure and robust."

<4>Brown hails fightback

CHANCELLOR Gordon Brown said Labour had fought back after being "written-off" in Scotland a week ago.

He added: "While the final results are yet to come, the vast majority of those who voted have voted for a Scotland that maintains its rightful place in Britain.

"To all those who came back to Labour, my resolve is that the Labour Party will listen and we will learn as we continue to work for and serve the people of Britain."

<4>Socialists are wiped out

THE Scottish Socialist Party was wiped off the political map in Scotland after party leader Colin Fox became the latest casualty to lose his seat.

The party leader lost out in the battle to retain his Lothian seat. His loss came after party colleagues Rosie Kane and Carolyn Leckie lost their list seats.

The party's one-time leader Tommy Sheridan, who formed the Solidarity party after quitting the SSP, was also ousted.

<4>No complaints from OAP

The leader of the Scottish Senior Citizens Unity party said he had "no complaints" after failing to win re-election to Holyrood.

John Swinburne, 76, was standing on the Central Scotland list and Motherwell and Wishaw constituency, but was unable to capture a seat as he did in 2003.

"I've no axe to grind - I'll find something else to do," he said.

<4>Minister ousted by SNP

ALLAN WILSON was the first ministerial casualty of yesterday's election, narrowly losing his seat to the SNP.

The Deputy Enterprise Minister lost to the SNP's Kenny Gibson by just 48 votes in Cunninghame North in Ayrshire.

The 52-year-old had been a junior minister for the past seven years and had represented his constituency since 1999.

<4>Shocked Ulster says No

It is unlikely that Northern Ireland will have electronic counting in elections in the near future, the chief electoral officer for the province has admitted.

Douglas Bain who observed electronic counting in Glasgow, said: "Patently everything has not worked well and the public perception is that there was a cock-up with electronic counting."

The SNP was a massive 20 seats up on its 2003 results, squeezing all the other parties in the process. Labour was four seats down, the Conservatives and Liberal Democrats each lost one seat and the minority parties and independents were reduced by 14.

Overall, the SNP won 47 seats, just one ahead of bitter rivals Labour, led by Jack McConnell.

To reach the 65 seats it would need to form a majority in Parliament, the SNP would need the Lib Dems and the Greens on side. Horse trading between the parties over who gets into bed with who is likely to go on for days.

The Tories won 17 seats and the Lib Dems 16. But the small parties were squeezed out with the Greens getting just two and the independents one - Margo MacDonald.

In a speech just before the final result was announced, Mr Salmond confirmed his party had won the most votes in the Holyrood election - but stopped short of declaring outright victory.

As the final results trickled in the parties were neck and neck, but the SNP edged ahead in the dying moments.

There was no hint of defeat as the SNP leader spoke for the first time since the full extent of the voting debacle became clear.

In a statesmanlike speech, Mr Salmond said Scotland had changed forever - regardless of the final result.

And he vowed to serve all the people of Scotland with "passion and humility" if he was given the chance.

He said: "The SNP has won the highest number of votes in both the constituency and the regional list.

"This is an historic moment.

"Never again will we see Labour assume a divine right to rule Scotland.

"Labour has no moral authority to govern Scotland."

In a day of drama the nation had waited with bated breath as a picture emerged of chaos caused by the new voting system and up to 150,000 spoiled papers.

Current First Minister Jack McConnell pledged to "keep all options open" on how to go forward from the knife-edge outcome and insisted he would not rush into any hasty coalition decisions. Speaking in Glasgow just minutes after Mr Salmond, he said: "I have not spent the last five-and-a-half years of my life as First Minister to make a snap decision this weekend about the future of our country - a decision that could affect every family across Scotland.

"It is right and proper this weekend that I and my party reflect on how best to take forward these priorities in government and the Parliament again.

"We will do so heartened by a result that was a significant achievement for the Scottish Labour Party, and confident that those who voted for us would expect no less from us."

However, the results were overshadowed by shambolic attempts to count the votes.

An investigation has been launched after a night of chaos at counts across the country left the final result a mystery for most of the day.

Critics point the finger at the decision to hold two different ballots - each with separate voting systems - on the same day.

They say many voters struggled to understand the complicated ballot papers, and confused the two systems.

On the parliamentary ballot, voters had to mark their choices with an "x", while the council paper required numbered preferences.

Up to 150,000 votes were rejected, while thousands of postal votes were delayed.

Computer glitches across the land also contributed to the mayhem as the new electronic counting system failed to deliver the smooth results promised.

A probe has been launched by the Electoral Commission to find out why so many ballot papers were spoiled.

In Glasgow Shettleston alone, more than 2000 papers were rejected - with numbers in Anniesland, Maryhill and Baillieston not far behind.

As the results finally started to come in there was jubilation for some and misery for others.

In Glasgow, SNP deputy leader Nicola Sturgeon made history by snatching Govan from Labour's Gordon Jackson at the third attempt in one of the toughest battles of the election.

She overturned the slim Labour majority to win the party its first ever constituency seat in the city - by just 744 votes.

Elsewhere in the city, Labour managed to hang on to its constituency seats, re-electing Frank MacAveety, Bill Butler, Charlie Gordon, Margaret Curran, Pauline McNeill and Patricia Ferguson.

And there was delight for David Whitton, former spokesman for the late Donald Dewar, who won Strathkelvin and Bearsden for the party from independent health campaigner Jean Turner with a 3,388 majority.

In Eastwood, a key target for the Conservatives, sitting Labour MSP Ken Macintosh clung to power by less than 1000 votes.

The MSPs elected under Glasgow's regional list were Tory Bill Aitken, Green Patrick Harvie, Lib Dem Robert Brown, and four SNP members - Sandra White, Bob Doris, Bill Kidd and Bashir Ahmad.

Mr Ahmad is the first Asian MSP at Holyrood.

Despite predictions the smaller parties could hold the balance of power, they were all but annihilated by Labour and the SNP.

Left-wing firebrand Tommy Sheridan lost his seat after eight years in the Parliament.

Despite hoping to be re-elected through the regional list, the Solidarity candidate failed to win enough votes.

His former party, the Scottish Socialists, had a dismal night too.

Both Carolyn Leckie and Rosie Kane failed to get re-elected, ending the SSP's representation at Holyrood.

Scottish Senior Citizen's Unity Party MSP John Swinburne was also booted out.

The Scottish Green Party won just two seats, while Margo McDonald will be the Parliament's only independent MSP.

Tory leader Annabel Goldie and Lib Dem Ross Finnie retained their seats through the West of Scotland regional list.