(Bloomberg) -- Panama’s top court ruled against a law approving a contract with First Quantum Minerals Ltd., throwing into doubt the future of one of the world’s biggest copper operations.

The company’s shares fell as much as 8.3% in Toronto before paring most losses as copper prices on the London Metal Exchange rose 1.3% on upbeat economic expectations in China and tight supply. Panama’s dollar bonds dropped as the government faces the prospect of losing a large source of revenue.

The ruling raises the possibility of a long and expensive legal battle between First Quantum and Panama if the dispute moves to international arbitration. Mass protests erupted last month after Panama’s congress approved a new contract with the Canadian miner, which has since been forced to suspend production because blockades mean it can’t access the supplies it needs.

Local lawyers are split over whether the decision means First Quantum must shut its operation immediately. A previous contract was ruled unconstitutional in 2017, but the mine continued to operate. However, the outpouring of popular fury against the project may force the government to take a harder line.

First Quantum sent an arbitration notice to the government of Panama over the weekend following disruptions at its port in the country. The $10 billion operation produces more than 1% of global copper output. 

“We want to affirm our unwavering commitment to regulatory compliance in all aspects of our operations within the country,” a First Quantum spokesman said in a written message. “We will comment further as additional details on the ruling are made public.”

The vote against the full contract was unanimous, the Supreme Court’s president Maria Eugenia Lopez told reporters on Tuesday. The ruling must now be published in the country’s official gazette, she said.

‘Terrible’ Implications

Local attorney Victor Baker, who filed an opinion on the case with the Supreme Court, said the ruling applies to the law approved in congress, not the underlying contract. Therefore a new contract can be drafted and the mine can operate in the meantime, he said, in a written reply to questions.

But Martita Cornejo, an attorney who filed the constitutional challenge, says declaring the law unconstitutional effectively voids the contract, and that the mine must close immediately. 

The country’s most liquid dollar notes due in 2036 fell as much as 0.6 cent to 95.6 cents after the ruling, according to indicative price data compiled by Bloomberg. 

The implications for the nation’s fiscal outlook are “terrible,” said Ricardo Penfold, a managing director at Seaport Global. 

“The country is running a fiscal deficit of 5% of GDP and this will increase it by about 0.6%,” Penfold said, in a written reply to questions. “And then you have the lawsuit.”  

Environmentalists, labor unions and others have held protests since Oct. 20 when congress passed a contract that gives First Quantum the right to produce copper for 20 years, with the option another 20-year extension.

Demonstrators argue that the contract violates national sovereignty and didn’t receive sufficient public debate prior to its approval in the legislature. Anti-mining roadblocks and violent protests have caused at least $1.7 billion in losses to business, according to the country’s National Council of Private Enterprise.

Read More: Looming Copper Squeeze May Force Market to Seek a Recycling Fix

First Quantum began to wind down operations last week as small boats blocked the mine’s port, preventing the company from shipping supplies to the mine, while protesters and mining personnel clashed this week along the road to the site’s entrance.

First Quantum and the government reached the new arrangement for the mine in March, extending the Vancouver-based firm’s contract and providing the government with a bigger share of profits. The deal required congressional approval before becoming law.

--With assistance from Vinícius Andrade.

(Adds shares update and copper prices in second graph.)

©2023 Bloomberg L.P.