The NSW government's $5 billion deal to privatise the Botany and Kembla ports will be at stake when the competition watchdog's case against NSW Ports goes to trial in two weeks.
The Australian Competition and Consumer Commission argues that the 2013 Botany deal and the 2014 Newcastle port lease are "illegal and anti-competitive" as they force Port of Newcastle to compensate Botany for every container it handles over a certain amount.
The government included the once-secret container fees in both agreements to boost the sale price for Botany and Kembla.
The ACCC is now pursuing NSW Ports, the consortium that bought the Botany and Kembla leases, but its real target is the government, which it cannot sue directly due to the technicalities of consumer law.
Federal Court judge Jayne Jagot, who will hear the case, this month ordered the parties to trial after they failed to reach an agreement through mediation. Hearings are scheduled to start on October 12.
It has become a test case in how to do, or how not to do, privatisation.
The government has been notably silent in trying to defend the agreements, which fly in the face of the free-market, pro-competition philosophy usually associated with the conservative side of politics.
The architect of the deals, former premier and treasurer Mike Baird, is long gone, at least giving the present regime the political breathing space to wipe its hands of some responsibility for the mess.
But extricating itself legally may prove harder. And costlier.
If the Federal Court case starts becoming uncomfortable, the Berejiklian government may be forced into a grim choice: pay the container fee itself, at a cost of perhaps $100 million a year, or give NSW Ports its money back.
It is hard to imagine the government is not engaged in some furious backroom negotiations with Port of Newcastle and NSW Ports to try to reset the playing field.
NSW Ports paid handsomely for a monopoly. It will want its pound of flesh if it loses it.
But restraining Newcastle from developing a large-scale container terminal, as the fee does, is not a good look for a government trying to rev up the state's economy in a recession.
An increasingly bitter industrial dispute engulfing Port Botany, which the shipping industry says is costing it millions, is only adding to the noise around the ACCC action.
Renegade NSW Liberal MP Matthew Mason-Cox said this month that the port privatisation deals had been orchestrated by merchant bankers who had "done over" Baird in a "sting" to block competition. Ouch.
The Liberals' state coalition partners, the Nationals, and Labor have both called on the government to support a Newcastle freight terminal.
Sources have told the Newcastle Herald that some in the federal government are also looking at the NSW port deals with raised eyebrows.
ACCC chairman Rod Sims has been strident in his criticism of monopolists controlling "bottleneck" infrastructure.
"It is bad for the economy," he told a transport research forum in Canberra last September.
The watchdog is pouring resources into mounting the legal challenge.
It remains to be seen whether it is open to a compromise if the government and port operators strike an arrangement outside the courtroom.
Alternatively, legal appeals could tie up the case in the court system well into the future.
Port of Newcastle, owned by China Merchants and Australian infrastructure investment fund TIF, paid $1.75 billion for the 99-year Newcastle port lease in 2014.
It agreed to the container fee at the time, but uncertainty over coal's long-term future has made a freight terminal increasingly attractive.
A successful ACCC action could give it a free kick, if not a penalty.
Port of Newcastle says its proposed $1.8 billion deep-water container terminal at Mayfield is "shovel ready". This may be an overly optimistic assessment, but the company insists it has funding in place.
The jobs and investment which would flow from the terminal are undoubtedly important to the region.
But the Federal Court case is a broader test of the value of privatising state-owned assets, in this case almost $7 billion worth, which will be watched keenly around the country.