MONTREAL -- The Harper government's most recent attempt at Senate reform has been declared unconstitutional in a stinging court ruling rendered Thursday.

The Quebec Court of Appeal released its opinion that the federal government had no right, with its Bill C-7, to create Senate elections and set term limits without seeking provincial approval.

The opinion could be used as evidence when the Supreme Court of Canada holds landmark hearings next month on the rules for reforming the upper chamber.

It says the Senate is not to be tinkered with on a whim.

The fathers of Confederation spent a lot of time considering the role and function of the chamber, it says, and the conditions they agreed to were essential to uniting the provinces into one country.

"The transcript of the pre-confederation conferences shows that the founding fathers discussed the role and composition of the Senate at length," the 20-page ruling said.

"There is no doubt that this institution was a fundamental component of the federal compromise in 1867."

The court even refers to Canada's first prime minister, John A. Macdonald, being dead-set against the idea of elected senators so to avoid having the new parliament resemble the Legislative Council of the old parliament of pre-Confederation Canada.

Now if the Harper government wants to reform the Senate, the court says, it needs to get approval from at least seven provinces holding half the country's population.

Reforming the Senate is a longstanding Conservative promise, with different proposals emerging since the party took office in 2006.

The government's most recent attempt, Bill C-7, would have set nine-year term limits for senators and created elections in provinces that wanted them.

The court said such a patchwork approach to elections was also in contradiction to the desires of Canada's constitutional framers.

In any case, the federal reform is already on hold amid intense debate over the nature of the upper chamber, which is currently being rocked by a spending scandal, with controversy surrounding expenses, residency situations and allegations of bribery and political interference.

Quebec's legal opinion comes as the Conservatives have drawn up a reference of their own -- this one to the Supreme Court of Canada, which will hold hearings on the Senate in November.

They have asked the high court for guidance on what would be necessary to reform the upper chamber or to abolish it outright.

The provincial-court battle, which ended with Thursday's 20-page ruling, began when the previous Charest government filed a reference motion in May 2012 with the Quebec Court of Appeal, seeking an opinion on the legality of C-7.

It argued that the bill was unconstitutional, that it threatened to affect the functioning of Canadian federalism, and that it would harm certain regions of the country.

The court replied, in its verdict, that it's in no position to comment on the usefulness of Senate reform or abolition -- which are political matters.

It said it's only responding to the Quebec government's questions about the rules for amending it. And under those rules, the federal reforms were declared a no-go.

"It follows from the principle of supremacy of the Constitution that political actors must comply with its text and its spirit. They cannot circumvent it on the pretext that the constitutional amending process is complex or demanding," Thursday's ruling said.

"To do so otherwise would disregard the principles of federalism, constitutionalism and the supremacy of law."

Quebec said it cannot support Senate reform unless the provinces are consulted, because such profound changes to the country's institutions shouldn't happen with a simple piece of legislation.

Senate elections would create a new dynamic in Canada's Parliament, where two chambers could suddenly compete over legislation and each claim democratic legitimacy.

While the Supreme Court of Canada is to hold hearings on the proposed reforms in mid-November, a written opinion could take months.

The Quebec government has said it hopes the appeal court ruling could be used during this exercise. It's exactly why the federal government sought to have the review stayed last March, but failed.

One constitutional lawyer says the Supreme Court can now cite the opinion, and he deems it a persuasive element in any pleading.

However, there are limits to the weight of Thursday's decision.

"The Supreme Court is not bound by a Quebec Court of Appeal decision," said Montreal-based constitutional lawyer Julius Grey.

"This is a major win for the provinces but it is not a binding one, it's not a final decision, on this type of issue. The final decision is only the one from the Supreme Court."

Quebec's Marois government is pleased with the court finding.

Justice Minister Bertrand St-Arnaud said the province will continue to oppose federal government attempts to act unilaterally in this matter.

"Ottawa cannot act alone in reforming the Senate," St-Arnaud said.

Now opponents of Harper's reform plan will be armed with lines from the Quebec legal opinion, such as the following:

"Bill C-7, if it had been adopted, would have been unconstitutional without the agreement of the majority of the provinces pursuant to subsection 38(1) of the Constitution Act, 1982, since its true nature was to amend the method of selection of senators and the powers of the Senate without having respected the applicable amending procedure. In reality, Bill C-7 attempted to circumvent that procedure."