Enbridge Inc. has won the opening round in the Michigan legal fight to keep its 540,000-barrels-daily Line 5 oil pipeline replacement alive by putting its Straits of Mackinac crossing in a new utility tunnel.

Michigan Court of Claims Judge Michael Kelly upheld a 2018 agreement on the tunnel with the state’s former Republican administration. The ruling rejected an opinion by Democrat Attorney-General Dana Nessel that the deal was unconstitutional.

Nessel and Michigan’s Democrat Governor, Gretchen Whitmer, announced that the decision would be appealed. Nessel said in statement, “The state of Michigan will not rely on a foreign corporation to protect and preserve our state’s most precious resource, its Great Lakes.”

Enbridge said the tunnel, to be built at its expense for up to $500 million, remains the best solution for concerns raised by environmentalists, tribal communities and the state’s year-old Democratic administration.

Despite the legal dispute, the company has continued preliminary work on the project. Enbridge has also received approval to install new safety supports for the 66-year-old pipeline’s current crossing on the bottom of the straits between Lakes Michigan and Huron.