Scottish council election: SNP wins most seats in Edinburgh
The SNP has returned the most councillors in Edinburgh
They now have 19 seats, just one ahead of the Conservatives who gained seven.
Labour slipped from first to third place in Edinburgh after losing eight seats to drop from 20 - actual seats - in 2012 to 12 this time.
All 17 wards have been declared with the SNP securing 19 seats, the Tories 18, Labour 12, Greens eight and Lib Dems six. The Greens gained one and the Lib Dems got three more councillors.
The council had been run by a Labour-SNP coalition.
Boundary changes have occurred since the last Scottish council elections so the BBC calculates overall seat changes based on notional 2012 results. They estimate what the results would have been in 2012 if the new boundaries had been in place.
A big casualty was the SNP's Richard Lewis, Edinburgh's culture convener, losing his Colinton/Fairmilehead seat.
Labour's Scott Arthur took the seat from the SNP in the constituency.
SNP group leader Frank Ross retained his seat in the Corstorphine/Murrayfield ward but Labour lost the seat of retiring council leader Andrew Burns in Fountainbridge/Craiglockhart.
Former Scotsman editor John McLellan has been elected as a Conservative councillor in the Craigentinny/Duddingston ward.
In total 63 councillors were elected to represent the City of Edinburgh Council, with a 50.5% turnout for the city - up from 42.6% in 2012.
How the BBC calculates the 2017 result
By BBC Scotland political editor Brian Taylor
Let's talk numbers - there have been boundary changes which mean that some comparisons are made with "notional" outcomes in 2012, the last time these councils were contested.
On that count, the SNP are notionally down by a fractional seven seats. However, in terms of absolute numbers, the Nationalists have ended up with more councillors than in 2012.
Plus the SNP are the largest party in Scotland's four largest cities - including Glasgow, where jubilant supporters attended their ousting of Labour. They have waited decades for that.
Returning Officer Andrew Kerr said: "This is a particularly busy time for politics, both nationally and locally, so I'm pleased that so many people have turned out to have their say in Edinburgh - even more than the last local government election in 2012.
"Thanks to voters for taking the time to participate, demonstrating the importance of local services to the public.
"I'd like to take this opportunity to thank our election team too, whose hard work and dedication has enabled the smooth-running of this election.
"I also want to congratulate all new and returning councillors, and welcome them to their role at the City of Edinburgh Council - I look forward to working with them in the years to come."
By Nick Eardley
BBC Scotland political correspondent
The SNP are now the biggest group on Edinburgh city council for the first time.
They've fallen some way short of a target of 25, but their win here is a symbol of the changes in Scottish politics - in 2003 not a single SNP councillor was elected.
Labour had been the biggest party here and falling into third place is a big defeat.
The Conservatives, as in other parts of the country, picked up votes in areas they haven't been strong in for some time.
Candidates who at the start of the day were pessimistic are now councillors.
The Lib Dems are delighted at their showing in the wards which make up Edinburgh West.
It's their key target at the general election and they made gains here. Elsewhere in the city their votes have been patchy, but sources say that's because their campaign has been focussed in the west.
The Greens had floated that they might win as many as 10 seats - but eight is a good result for them, adding two to their tally from 2012.
Negotiations for a coalition are likely to start today. The SNP have already ruled out a deal with the Conservatives - one source said they will be looking towards what they called a "progressive alliance".
Meanwhile, Labour remains the largest party in East Lothian despite the Conservatives gaining four seats.
Labour gained one to go to nine, the Tories went up to seven and the SNP slipped to six - down three.
Independents lost two seats.
East Lothian had been a Labour/Conservative coalition administration.
The Conservatives have gone from zero to five seats on Midlothian Council.
They are now just one behind the SNP, who dropped from eight to six, and two behind Labour, who went from eight to seven.
The Greens and independents both lost seats.
The previous administration had been run by the SNP, with the help of an independent.
The Conservatives have gone from one seat to seven on West Lothian Council.
The SNP have dropped two seats to 13, becoming the largest party, as Labour lost four seats and ended up with 12.
West Lothian had been a Labour minority administration.
The SNP has gained four seats to become the largest party on Fife Council as Labour lost 10 seats.
The Conservatives also made big gains, going up 12 seats from three to 15.
The SNP now has 29 seats and Labour 24.
The Lid Dems went down from 10 to seven and three independents lost their seats.
Fife had been a Labour minority administration.