An Ontario court has thrown out a lawsuit against the provincial government over the controversial partial sale of Hydro One.

The lawsuit filed last December by the Canadian Union of Public Employees alleged the sale of shares in the utility was "motivated by improper and ulterior purposes," namely to reward benefactors of the Ontario Liberal Party.

It aimed to stop the sale of any more shares of Hydro One, though the government has since moved forward with its plan.

Lawyers for the government had filed a motion asking that the lawsuit be dismissed, arguing there was no basis for challenging government policy and no conduct was unlawful.

In a decision released this week, Justice Peter Cavanagh sided with the province, calling the lawsuit an "impermissible attack on a core policy decision taken by the ministers."

He said the plan is "immune from judicial review in a civil tort action."