Ontario Premier Doug Ford will invoke the constitutional notwithstanding clause to override a judge's decision that blocks his government from slashing the size of Toronto city council nearly in half.

The dramatic step would make Ford the first Ontario premier to use the clause, which allows government to create laws that operate in spite of certain charter rights that the laws appear to violate. He also threatened to use the clause again in the future, but didn't provide any specifics.

In an unprecedented and scathing decision, Justice Edward Belobaba ruled Monday that Ford's Progressive Conservative government "clearly crossed the line" with its Better Local Government Act, which aligns municipal ward boundaries with provincial ridings, cutting the potential number of councillors from 47 to 25 after the Oct. 22 election.

"We're taking a stand," Ford said of the court decision, noting the government will also launch a legal appeal.

"The result is unacceptable."

Mayor John Tory said Ford's decision to use the notwithstanding clause to get Bill 5 passed is 'wrong,' 'contrary to the Charter' and 'not acceptable.' (Cole Burston/Canadian Press)

In his highly anticipated ruling, Belobaba calls the Better Local Government Act, also known as Bill 5, "unconstitutional."

"Passing a law that changes the city's electoral districts in the middle of its election and undermines the overall fairness of the election is antithetical to the core principles of our democracy," Belobaba says in his written decision.

Ford's threat to overrule the judge again leaves the city's election process in limbo.

Toronto Mayor John Tory said city council will hold a special meeting on Thursday to hear from the city solicitor. Tory said he'll also be encouraging PC lawmakers to vote against using the clause.

"This is a mistake. This was a mistake from the beginning," Tory told reporters of Ford's tactics.

In a tweet Monday night, Tory said he had met with Prime Minister Justin Trudeau, who was in Toronto for a women's summit, to discuss his concerns about the province's use of the notwithstanding clause.

"I appreciate his support for democratic principles, democratic institutions, and the importance of respecting cities," Tory said on Twitter.

Thanks to Prime Minister <a href="https://twitter.com/JustinTrudeau?ref_src=twsrc%5Etfw">@JustinTrudeau</a> for meeting with me tonight to talk about my concerns around the province's use of the notwithstanding clause. I appreciate his support for democratic principles, democratic institutions, and the importance of respecting cities. <a href="https://t.co/1y5FDRsaBj">pic.twitter.com/1y5FDRsaBj</a> —@TorontosMayor

The city clerk's office had rearranged the race to fit the government's 25-ward plan in mid-August, then after Monday's court ruling began the process of running a 47-ward election. Now, it's unclear what version officials will have to carry out.

It's also sparking backlash at Queen's Park.

Andrea Horwath, the leader of the Official Opposition, said she was "astounded" by Ford's announcement and accused the premier of trampling on the charter rights of Ontarians just to carry out a "revenge plot" against the city.

The notwithstanding clause, Horwath told reporters, is a "brutal tool" to govern with.

Ford attacks councillors during remarks

Ford's government made the shocking move to upend Toronto's election plans in July, months after candidates had already started filing nomination papers in a 47-ward system.

Now, Ford says he will recall the Ontario legislature on Wednesday to reintroduce the Better Local Government Act and will invoke the notwithstanding clause — here's a CBC News backgrounder on what that means — at that point.

Ford, who served one term on city council representing the Etobicoke area when his late brother Rob was mayor, said cutting the number of councillors would stop what he calls "dysfunction" at Toronto City Hall while saving some $25 million over four years.

He said the only people fighting the ruling are special interest groups and left-wing councillors hoping for a "free ride" on the backs of taxpayers.

"They're just worried about a job," he said.

However, would-be councillors, private citizens and the Toronto District School Board all objected to reducing the number of wards in court, while Ford's plans have also been condemned at a number of town hall meetings in the city.

Tory, in his remarks, pointed out that Ford didn't campaign on the plan to slash city council and held "not a minute" of public consultation as it pushed Bill 5 through the legislature.

Mayor supports judge's decision

Earlier, Tory, who is seeking re-election this fall, says he wants answers from the province about why it tried to cut the size of council to begin with.

"You can't change the rules in the middle of the game. That's not fair to anyone, and this is not a game," he said.

"Democracy does not belong to a few of us, it belongs to all of us," he said. "No law should ever fail to take that into account and all of us as lawmakers, regardless of where we're carrying out those responsibilities, should always remember that."

Toronto city council, which supported redrawing the ward boundary map to add more councillors after a years-long consultation process, voted to condemn Ford's plans, and then to join the court challenge — although some councillors supported the premier.

Judge highlights issues with plan

Belobaba said the act has two major problems:

Because it was passed in the middle of an election campaign, it breached the freedom of expression of municipal candidates.

For some councillors, it nearly doubled the size of the population they represent — from an average of 61,000 people per ward to almost 111,000. That, Belobaba said, "breached the municipal voter's right to cast a vote that can result in effective representation."

At one point in the decision, Belobaba highlighted a number of questions about why the province decided 25 wards is the way to go.

"If there was a concern about the large size of some of the city's wards (by my count, six wards had populations ranging from 70,000 to 97,000), why not deal with these six wards specifically? Why impose a solution (increasing all ward sizes to 111,000) that is far worse, in terms of achieving effective representation, than the original problem? And, again, why do so in the middle of the city's election?"

The province's response, Belobaba wrote: "Crickets."

Tory said that was an "extraordinary" thing to see in a judge's ruling, adding the province needs to answer those questions if it tries again to reduce the number of councillors.

'We Win!' lawyer tweets

Rocco Achampong, a lawyer planning to run in the upcoming election who became the first to challenge the government's plan in court, tweeted simply: "We Win!" after the ruling was released.

A number of other plaintiffs, including city lawyers, joined Achampong's legal challenge, despite the fact many legal experts expected the province to prevail in court.

Coun. Josh Matlow tweeted after the decision: "We took a stand for democracy and justice. And we won."

Downtown Coun. Kristyn Wong-Tam said she's delighted with the ruling.

"The province will have a very uphill battle on the appeal process," Wong-Tam told CBC Radio's Metro Morning.

Not everyone agrees.

The Canadian Taxpayers Federation, an intervener in the case that was supporting the government, issued a statement expressing disappointment with the decision.

"We encourage the Ford government to appeal this decision immediately," the organization said. "Waiting an additional four years to reduce the size of city council is a missed opportunity to save taxpayers money."

​The Better Local Government Act didn't affect the number of councillors in any other Ontario city.

Also known as Bill 5, the legislation also cancelled planned elections for the head of council position in the regional municipalities of Muskoka, Peel, York and Niagara, turning them into appointed roles. Belobaba said his ruling does not impact that aspect of the bill.

With files from Lauren Pelley, Mike Crawley and The Canadian Press