A small Quebec town that was facing a $1-million lawsuit from an oil-and-gas exploration company for trying to protect its own water has won its court battle and could see half of its legal fees reimbursed by the Montreal-based company.

The municipality of Ristigouche-Sud-Est has been waiting on this decision from Quebec's Superior Court since August 2013, when Gastem sued the municipality of 157 people.

Mayor François Boulay said citizens have been worried and anxious for the past four years. He was relieved to see the judge ruled in their favour.

"I can't hide this is a sweet moment," he said Wednesday after the ruling came down.

Company had drilling permit

Gastem obtained a drilling permit from the province in 2011 to search for oil and gas on Quebec's Baie-des-Chaleurs, where Ristigouche-Sud-Est is located.

After residents started voicing their concerns about the impact the drilling could have on the municipality's drinking water, the town passed a bylaw in February 2013, setting clear rules.

A two-kilometre distance had to be respected between drill sites and residents' wells. The bylaw also banned the introduction of any chemical substances into the soil.

Gastem sold its drilling rights to Petrolia in 2013, one month before the lawsuit was filed in Superior Court. (CBC) After sending a formal notice, Gastem sued the municipality in August 2013, claiming $1.5 million dollars in damages, which was later lowered to $984,000.

It argued the town adopted its bylaw hastily, illegally targeting the company and making it impossible for Gastem to pursue activities on the site, for which it had a valid permit.

"Abusive" lawsuit

Superior Court Justice Nicole Tremblay ruled the company should have tried to have the bylaw annulled before seeking any compensation.

In her 16-page ruling, Tremblay said contrary to what Gastem argued in court, the town council was not pressured into passing this bylaw by environmentalists or forceful residents.

"The town councillors did not act on a whim," she wrote.

Tremblay said a municipality has the right to protect its territory based on the precautionary principle.

Since there was no provincial law in place at the time defining the rules around water protection, Tremblay said the town was in its rights to apply its own bylaw.

The judge ordered Gastem to reimburse 50 per cent of the legal fees Ristigouche-Sud-Est incurred, and an additional $10,000 to cover the fees for the public relations company the town hired.

The town of Ristigouche-Sud-Est, in the Gaspé, was able to raise $330,000 in a crowdfunding campaign to cover its legal fees. (Geneviève Génier-Carrier/Radio-Canada) The lawyer representing the town said this punitive measure was a significant element of the ruling.

Jean-François Girard said it could make companies think twice before suing a municipality that stands in their way.

"I think it sends a very important message," he said.

Gastem has 30 days to reimburse the $164,000 sum, or to appeal the verdict.

Gastem's Chairman and CEO Raymond Savoie said the company will take the time to review the ruling before commenting.

Crowdfunding campaign to help other towns

Boulay said the lawsuit cost the town $370,000 in legal fees.

The balance of what will remain, if Gastem reimburses its share, will be covered by the crowdfunding campaign launched to support the town, which so far has raised almost $330,000.

"We raise our glass of water to all those who supported us," Boulay said.

Then the leftover money will be donated to other similar causes, said Boulay.

Despite his relief to see this chapter come to an end, he said the issue of water protection is far from settled in Quebec.

"The risk is still there. The claims on our territory are still there," he said.

Still a long battle ahead

Boulay said the province did little to nothing to support the town during the whole process.

"I'm not even sure they were watching from the bleachers," he said.

Gastem sold its permits to Petrolia in July 2013, before the lawsuit was even filed.

Boulay said if the company showed up at its doorstep tomorrow, the new provincial law that came into effect in 2014 would have precedence over its municipal bylaw.

Under Quebec's regulations, an oil exploration site must be at least 500 metres from a water source.

Ristigouche-Sud-Est is on the south side of the Gaspé peninsula. (Radio-Canada)

Boulay said this means Petrolia could very well decide to drill 510 metres from a well.

That's why he joined a consortium of 364 municipalities that's demanding the province establish a two-kilometre residential buffer zone to protect homeowners from drilling.

Boulay said the province has yet to answer the consortium's repeated requests, and said the mayors will be meeting in Drummondville on March 24 to establish a course of action.

"We find it astounding that a minister can't give a clear answer to 364 municipalities."