MONTREAL—Parts of the defunct long-gun registry will live on after the federal government was ordered on Monday morning to protect records gathered about Quebec’s guns and turn over relevant data to the province.

Judge Marc-Andre Blanchard issued a permanent injunction from the bench of the Quebec Superior Court on Monday. The Quebec court's stinging rebuke accused the federal government of violating principles of Canadian federalism and its 42-page verdict cited the prime minister's words as evidence of that improper behaviour.

The verdict gives the federal government 30 days to hand over the registry data for Quebec, which is the only province where the case applies. However, it's likely just one more round in a broader legal battle. The issue is expected to wind up before the Supreme Court of Canada.

Blanchard wrote that the creation of the gun registry included multiple agreements over how the information would be gathered and accumulated. The judge ruled that the registry data cannot be viewed as being strictly "federal" and said Quebec has a right to it.

"There is a complex web between the federal, provincial and municipal weaves the registry of firearms which meant that it could not exist without the close and constant co-operation of everyone," Blanchard wrote in his conclusion.

"The implementation of the firearms registry -- although under the federal power to legislate criminal law -- creates a partnership with Quebec, particularly with regard to the data contained in the registry."

The verdict quotes Harper saying he has no intention of helping another level of government create a long-gun registry. The judge then declares that Canadian constitutional law encourages lawmakers to practice flexible and co-operative federalism and not work to "undermine" that concept.

The Conservatives campaigned during the 2011 election on a pledge to eliminate the law requiring gun owners to register their rifles and long guns.

In April, bill C-19 was given royal assent. The law eliminated the registry and called for the destruction of all the data collected during the 16 years during which weapons were registered.

Outgoing Quebec Justice Minister Jean-Marc Fournier had asked Ottawa for the records on the 1,560,359 long guns registered in Quebec to create a provincial registry. Quebec argues that it has a right to the information because its taxpayers helped build and pay for it. The federal Conservatives refused and told Quebec to build a registry from scratch if it wants to.

Having suffered a number of shootings, Quebec has a strong gun control movement galvinized after the massacre at the Polytechnique in 1989. Gun-control advocates applauded Blanchard's ruling.

"This just helps make my week just a bit better," said Louise de Sousa, whose daughter Anastasia was killed in the Dawson College shooting. "I'm sure she's smilling up above and saying 'Yes, something good will come out of this.'"

"The decision of the court reaffirms the fact that the data on guns is useful, that the province which contributed to collecting it is entitled to keep it and that it is in the interest of public safety to maintain it," the Coalition For Gun Control said in a statement.

Opponents of the program called it wasteful and irrelevant in stopping crime. Its supporters, however, including some police organizations, described the registry as a valuable tool in law-enforcement's arsenal.

The federal government reacted swiftly and critically to Monday's verdict.

"I am disappointed with today's ruling and will thoroughly review the decision," Public Safety Minister Vic Toews said in a statement.

"The will of Parliament and Canadians has been clear. We do not want any form of a wasteful and ineffective long-gun registry...

"Our Conservative government will continue to fight against any measures that needlessly target law-abiding hunters, farmers and sport shooters."

--with files from The Canadian Press.