The state must conduct a new review of how to best clean up a contaminated LIRR site in Yaphank that was used by the railroad as an illegal dump for decades, a judge ruled Wednesday.

The ruling by Justice H. Patrick Leis of state Supreme Court in Central Islip could cost the Long Island Rail Road and its parent agency, the Metropolitan Transportation Authority, as much as $43.6 million if a new review requires more extensive work than an initial review required.

Leis said in a ruling from the bench that the state Department of Environmental Conservation had no authority to conduct its earlier review under its Voluntary Cleanup Program because that program had never been authorized by the State Legislature.

Leis ordered DEC to put the 7.5-acre site near River Road on its brownfields registry and follow agency rules for evaluating the site for its potential danger to the public.

DEC had ruled last year that the LIRR could contain the 100,000 cubic yards of contaminated material by installing stone, concrete and asphalt caps.

An LIRR spokesman said in a statement the railroad was “disappointed by the ruling and we are considering our legal options.”

advertisement | advertise on newsday

Like the DEC, the MTA is a state agency.

The Town of Brookhaven sued the state, arguing that the review was inadequate and that the contaminated material should be removed.

Town officials said the capping plan could pose “a serious threat to the community” because groundwater could be polluted by zinc, arsenic, lead and copper from soil at the site.

Robert Calica, a Garden City attorney retained by the town, said the use of the Voluntary Cleanup Program was “a private deal” that allowed the LIRR to avoid the stringent state review that owners of private property usually face.

He said DEC and the railroad entered into the agreement in 2002, the last year the voluntary program was in effect. The program expired the next year when the legislature passed a brownfields law.

An attorney representing the MTA, Philip Karmel of the Bryan Cave firm in Manhattan, told the judge that DEC rules gave it the power to enter into voluntary remediation agreements.

The judge said documents showed that capping the site would have cost the LIRR an estimated $7.6 million, while a full cleanup with removal of the contaminated material would cost about $43.6 million.

Calica said that while the town favors a more extensive remediation, there is no way to know what DEC will decide during a new review.

“We don’t know what the DEC would have done if they did their job right,” Calica told the judge.

The state attorney general’s office, representing DEC, declined to comment on the ruling.