So after a hard-fought campaign and hours of counting, what did the result mean for candidates and their parties?

SNP

A win for Mark McDonald was never seriously in doubt and the SNP's tireless and brilliantly well-organised campaign ensured a comfortable majority of 2025 in the end.

However, the Nationalists' share of the vote - 42% - was well down on the 55% achieved by the late Brian Adam in 2011 (whose majority, on a higher turnout, was a whopping 7175).

Labour, by contrast, increased their share of the vote from 28% to 33%.

The SNP claimed it was a more than satisfactory result for a party in mid-term Government.

But they will be concerned that so many voters who backed them two years ago simply stayed at home.

Despite insisting the by-election was about local issues - schools, the council tax and the infamous Haudagain roundabout - they will be asking whether the looming independence referendum affected their vote.

Labour

As the long campaign wore on it became clear that Labour could not match the SNP's formidable election-fighting machine.

Yet Willie Young, a colourful and occasionally controversial city councillor, achieved a 9% swing from the SNP.

They did not come as close as they privately hoped but the result still represents fair progress for Labour in its first by-election test since Johann Lamont became the Scottish party leader.

If the swing is replicated at the next Holyrood election - a very big if -  27 or 28 SNP constituency MSPs would lose their seats to Labour.

At the count, Labour's activists did not look too downhearted.

LibDems

After a disastrous election in 2011 when the Lib Dems' complement of MSPs was slashed from 16 to five, and very poor council elections last year, Christine Jardine achieved a pretty good result for her party.

They would have settled for keeping their deposit, but defeating the Tories was a bonus and will give the LibDems a boost. Their share of the vote jumped from 6% in 2011 to 8%.

A late push and focusing on parts of Donside which lie in LibDem MP Malcolm Bruce's Gordon constituency helped as

the battle between the SNP and Labour squeezed all the other parties. Talk of a 2015 general election Lib =Dem wipeout may be premature.

Conservatives

There were not too many positives for the Tories to take from the campaign apart, perhaps, from blooding a promising young candidate in Ross Thomson who fought hard in the leafier parts of the constituency like Bridge of Don.

They avoided the disaster of finishing behind UKIP - but that was about it. Tory spinners were muttering that some of their supporters voted Labour to send an anti-independence message to Alex Salmond.

UKIP

UKIP's poll of 1128 meant the anti-EU party lost their deposit, failing the test set by Nigel Farage, as candidate Otto Inglis confirmed during the count. The result makes it hard for the UKIP leader to claim his party is making progress across the whole UK.