A controversial attempt to build a secondary school on common good land has been supported at the Scottish Parliament.

The decision by MSPs is the strongest official indication that a private bill could yet pave the way for a replacement Portobello High School in Edinburgh.

But the wider implications of the local plan have prompted opponents to claim there will be "dire consequences" for green spaces across the country.

The initial proposal for the school stalled when it was ruled at the Court of Session that the city council's preferred site, Portobello Park, is "inalienable" common good land.

The council now has to secure parliamentary approval to change its use to allow consideration for construction.

Supporters of the plan urge the Scottish Government to work with the council to sort out the "legal loophole" which they say is holding up construction.

Labour MSP Siobhan McMahon, who convenes the Holyrood committee looking at the bill, said it will not set a precedent.

"While we recognise it will be open to other councils to follow this route if they so choose, any such bill would have to be considered on their own circumstances and merits," she told Parliament.

Local government minister Derek Mackay said a wider approach to common good land will be addressed separately in the proposed Community Empowerment Bill.

"The Government recognises the special place that the common good plays in the life of the nation and many local communities, and this bill in no way erodes that," he said.

Describing the progress of the Portobello legislation, he said: "I am pleased that we're now approaching the point where it will be possible for the council to deliver this key project, and from a position which ensure the fullest possible consideration with regard to delivering the best outcome for the Portobello community as a whole."

The government does not have a view of the merits of the site, he said.

Local Lothians MSPs gave their backing to the school plan.

Labour's Kezia Dugdale said it had been 2,596 days since the plans to build the new high school were approved by the council.

She told how the existing school had tiny stairwells where pupils were often getting "crushed" while moving between classes.

She said: "There are temporary buildings that have been there for years that the kids are taught maths and technology in. The assembly hall roof blew off when the winds were strong and the school had to be closed for a day."

Conservative MSP Cameron Buchanan dismissed fears it would lead to other areas of common good land being built upon.

"No such danger exists," he said, adding that the Bill is "about Portobello Park and Portobello Park alone".

Green MSP Alison Johnstone, a former Edinburgh councillor, said the process has been "deeply divisive" for the local community.

But she said the existing school was "poorly designed" and "had not stood the test of time".

"The issue now is about the conditions which are attached to the school be built," she said.

"What assurances can be secured that new playing fields will always be accessible to the community at large? What certainty is there that the old high school site will be transformed into high quality green and open space to be enjoyed for generations to come?"