TORONTO -- Canada's top court has upheld an Ontario law that slashed the size of Toronto's city council nearly in half during the last municipal election, with a narrow majority ruling the move was constitutional.

In a split 5-4 decision issued Friday, the Supreme Court of Canada found the change imposed by Premier Doug Ford did not violate the free-expression rights of candidates or voters.

Writing for the majority of the panel, Chief Justice Richard Wagner and Justice Russell Brown said municipal elections are "merely statutory platforms without a constitutional basis" and, as such, provinces can change the rules as they wish, barring "substantial interference."

The city failed to prove the provincial measure "radically frustrated the expression of election participants such that meaningful expression was effectively precluded," they wrote.

The municipal campaign was well underway in 2018 when Ontario passed a law that reduced the number of Toronto council seats to 25 from 47, aligning them with federal ridings.

Ford -- a former Toronto city councillor and failed mayoral candidate -- argued at the time that the change would streamline council operations and save $25 million. Critics denounced it as undemocratic and arbitrary.

The majority of Supreme Court judges hearing the case found there had been enough time to adjust to the new system before the October 2018 vote.

"The candidates and their supporters had 69 days -- longer than most federal and provincial campaigns -- to reorient their messages and freely express themselves according to the new ward structure," they wrote.

"Candidates continued to campaign vigorously, canvassing and debating about issues unrelated to the impugned provisions, the size of council or the ward boundaries. And even had they not, nothing in the Act prevented them from doing so."

Many municipal candidates had successful campaigns during which they raised significant amounts of money and drew many votes, which would not have been possible if their expression rights had been violated, the majority on the panel said.

While some candidates' expression may no longer have been relevant because of the ward changes, the charter does not include the right to effective expression or messaging, they found.

The dissenting judges, however, found the timing of the legislation did amount to an infringement of free-expression rights.

"The timing of the Act, in the middle of an ongoing election, breathed instability into the 2018 municipal election, undermining the ability of candidates and voters in their wards to meaningfully discuss and inform one another of their views on matters of local concern," Justice Rosalie Abella wrote on behalf of the dissenters.

Since the election nomination period was extended to mid-September in light of the change, candidates and voters essentially had five weeks to adjust, she wrote, noting they would've only had the full picture of the situation after nominations closed.

Moreover, those five weeks were "marred by the destabilizing impact of the timing of the legislation," Abella wrote.

The city had also argued the provincial law should be struck down because it violated unwritten constitutional principles of democracy.

The majority on the Supreme Court panel found that unwritten constitutional principles such as democracy can be used to interpret the Constitution but not to throw out legislation. The dissenting group disputed that finding.

The government of Ontario welcomed the ruling Friday, and repeated its position that the change made Toronto city council more efficient.

"We have never been afraid of making the tough decisions that deliver the best outcomes for Ontarians, and we'd encourage the City of Toronto to remain committed to this positive model moving forward," Steve Clark, the minister of municipal affairs and housing, said in a statement.

Opposition legislators said Ford's actions in cutting council were nonetheless unjustified.

"There's no doubt that Doug Ford seems to have won this, but that doesn't make it right. Our municipalities deserve respect, not a premier that sets out to just crush them," Ontario NDP Leader Andrea Horwath said during a news conference in Hamilton.

Toronto Mayor John Tory said the case's outcome -- and the fact that it was heard by the Supreme Court at all -- "demonstrate(s) the importance of this matter."

"I disagreed with the way the province went about changing the size of city council in the middle of the 2018 election and as mayor together with city council we have made that very clear all the way to our highest court," Tory said in a statement.

Some former municipal candidates affected by the provincial measure expressed frustration with the court's decision.

Jennifer Hollett had planned to run in the 47-ward Toronto election but dropped out of the race once it was confirmed to proceed with only 25. At the time, she said the move felt like "candidate suppression."

On Friday, she tweeted that the Supreme Court ruling was "not good."

"While slashing Toronto city council in half in the middle of an election, denying a free and fair vote may be within the law, it doesn't make it right," she wrote.

Friday's decision -- which came roughly a year before Ontario's next municipal vote -- marked the culmination of a long legal fight.

Toronto first successfully challenged the legislation in Ontario's Superior Court, with a judge deeming it unconstitutional.

Ford then threatened to use the Constitution's notwithstanding clause to push through the legislation but didn't have to invoke it because the province won a stay of the decision pending appeal.

Ontario's top court delivered a split decision, with three judges ruling to overturn the Superior Court decision and two to uphold it.

The Supreme Court then agreed to examine the city's challenge of the Appeal Court ruling.

- with files from Allison Jones.

This report by The Canadian Press was first published Oct. 1, 2021.