Tesla Inc. (TSLA.O) has secured a minor legal victory in Ontario in its push for equal treatment as the company looks to defend its direct-to-consumer business model in numerous markets.

The Ontario case comes as Tesla struggles to move ahead with its retail model in the United States, where it has not used franchised dealerships.

Multiple U.S. states including Michigan, New Jersey and Missouri have passed laws in recent years to prevent Tesla from selling vehicles directly to consumers following pressure from automobile dealership associations.

Ontario Superior Court judge Frederick Myers ruled Monday that the provincial government's decision to exclude Tesla from a grace period for an electric vehicle rebate program was arbitrary and had singled out Tesla for harm. The ruling requires the government to review the program so that it includes Tesla or provides adequate justification for the company's exclusion.

Tesla launched the case after the government ended the rebate program worth up to $14,000 per vehicle on July 11, but said it would extend the rebates to vehicles already sold through dealerships if they were delivered and registered within 60 days.

Myers found the government had originally tried to exclude Tesla from the extension by specifying only vehicles ordered through a dealership would be eligible for the extension. When it learned Tesla did indeed sell through its own dealership network, the government further specified to the company that only franchised dealerships would be eligible.

Tesla CEO Elon Musk has staunchly defended the company's direct retail model.

Musk said in a blog post that franchised dealerships don't have enough incentives to sell electric cars and that the company needs to place its sales venues in areas where it can attract foot traffic and educate potential customers.

The Ontario Progressive Conservatives said they had specified only franchised dealerships were eligible for the rebate extension to help protect small- and medium-sized businesses that may have been hit by the program.

Tesla responded that many franchised car dealerships in Ontario are owned by large businesses that own numerous franchises.

The electric carmaker said it was pleased with the court's decision to strike down the "unfair and unlawful" transition plan.

"Tesla only sought fair treatment for our customers and we hope the Ministry now does the right thing by delivering on its promise to ensure all EV-owners receive their incentives during the wind-down period."

A spokeswoman for Attorney General Caroline Mulroney said the government is "reviewing the ruling and will make a decision on how to proceed in the coming days."

Sara Singh, the Ontario NDP critic for the ministry of the Attorney General, said in a statement that the decision means Premier Doug Ford is sticking people with the bill for his torn up contracts and cancelled programs.

"This is likely only the first of many decisions against the Ford government's decision to rip up hundreds of cap-and-trade and green energy contracts," she said.

It's not yet clear, however, what the government will have to do in response to the decision.

Myers stopped short of setting aside the limitation of the transition program to franchised dealers, noting that doing so would require the government to fund subsidies to Tesla's customers.

He instead sent the policy back to the government for review, saying that if the government wants to transition out of the electric car subsidy program it must do so in a lawful manner.

The problem was the government hadn't provided a legal justification for its policy, said Bruce Ryder, an associate professor at York University's Osgoode Hall Law School.

He said the legal loss on policy isn't unusual, but that he was surprised how quickly the new government ran into legal issues.

"It's maybe a little unusual how quickly this government has got off the mark, and has been a little bit like a bull in a china shop from a legal point of view."

The legal dispute with Tesla is just one of several the Progressive Conservatives face, including a Superior Court challenge Friday on Ford's cuts to Toronto city council numbers.

Ryder said the government could face more problems if it rushes ahead without properly considering policy.

"There could be some other legal setbacks coming very soon, precisely because from a legal point of view, this government seems to be so anxious to move speedily on a number of files...that they didn't pay enough attention to the legal limits on their powers."

The ruling has left potential Tesla customers in limbo, unsure of whether or not they'll see the $14,000 in subsidies they had counted on when ordering vehicles.

Kurtis Evans, a teacher in Toronto who had ordered a Tesla 3, said he was pleased by the decision and grateful that Tesla decided to fight for customers, but wasn't sure what will happen.

"At this point I don't know what will happen next...Hopefully, the province makes the right choice. I'm not counting on it."

Tesla said it had 600 active customer orders when the government ended the program in July. At the time, the company had 34 unallocated vehicles on its lots plus 319 in transit on trains and trucks. The company said 175 customers had cancelled their orders since the program ended.