The government set a target of reducing class sizes to 18 in P1 to P3
A council has called for a legal loophole on class sizes to be closed after a series of successful appeals by parents.
BBC Scotland has learned that Edinburgh City Council recently lost 10 appeal cases.
The council said a 25-pupil limit for primary classes did not apply if parents went to appeal.
The Scottish Government said it would consider new legislation but insisted average class sizes had fallen.
Many of the appeals have been made by parents living outside the catchment area for the popular Sciennes Primary School.
The council now plans to raise the limit at that school to 30 pupils.
Reducing primary class sizes is a flagship policy of the SNP which has a target of reducing class numbers in P1 to P3 to a maximum of 18.
A Scottish Government spokesman said average primary school class sizes had fallen to an all-time low of 23.2.
The spokesman added: "We need to ensure that legislation enables local and national government to set class-size limits and supports the rights of parents to make placing requests and are currently considering whether current legislation needs to be changed across the country.
"The previous administration did not legislate to protect their policy of keeping P1 classes to a maximum of 25.
"The majority of parents in Scotland choose for their children to attend their local school. Parents can, however, express a preference for the school choice and the latest statistics show most of these placing requests - over 80% - are granted."
Edinburgh City Council's education convener, Councillor Marilyne MacLaren, called on the Scottish Government to legislate to close the loophole.
She said: "Without clear support from the Scottish Parliament it will become much more difficult for local authorities to keep class sizes down in line with government guidance.
"The door is wide open for legal challenges and this will inevitably lead to classes growing in size.
"The situation as it stands can lead to inconstancy and unfairness for both the parents and the school - none of us want that."
Ronnie Smith, general secretary of teaching union the EIS, said: "I entirely understand the concept of parental choice but I think we need to be honest and say that there always has to be a limit.
"We cannot have unfettered choice, just like we cannot always get the dentist or we can't get the hotel we want because it is full up.
"Classes and schools get full up, and that is a reality with which we have to live.
"The present government was elected on a promise to the people of Scotland that no class size in P1-3 would exceed 18 - that was the policy promise and they should deliver on it."
This page is best viewed in an up-to-date web browser with style sheets (CSS) enabled. While you will be able to view the content of this page in your current browser, you will not be able to get the full visual experience. Please consider upgrading your browser software or enabling style sheets (CSS) if you are able to do so.