In the end, it all came down to the last of Dundee’s eight wards to be announced.
The SNP needed to retain its two seats to keep control of the council.
But while Kevin Cordell kept his seat, Vari McDonald lost the seat vacated by retiring administration leader Ken Guild.
The SNP will now either run Dundee as a minority administration or seek a formal or informal coalition although, theoretically, unionist parties could band together to keep them out of power.
Angela Lyall also lost the seat that had been held by Laurie Bidwell for Labour.
The beneficiaries were the Liberal Democrats’ Craig Duncan and Phillip Scott of the Conservatives.
Mr Duncan said: “It’s the result of a long campaign over several years.
“I feel vindicated: the people of Broughty Ferry have said there is a place for consensus and moderation in these times of Yes and No.”
Result
Clementsmith Pol Stanley Scottish Green Party 232
Cordell Kevin Malcolm Scottish National Party (SNP) 1608
Duncan Craig Liberal Democrat Focus Team 1422
Johnson Paul Dundee against Cuts – TUSC 43
Lyall Angela Scottish Labour Party 1054
McDonald Vari Scottish National Party (SNP) 1075
Scott Derek Scottish Conservative and Unionist 2859
Scott Philip Scottish Conservative and Unionist 635
Walker Calum David Alexander UKIP 47