Dallas-based Energy Transfer LP owes Williams Cos. a $410 million breakup fee after nixing a plan to merge the two companies in 2016, a judge has ruled.

Energy Transfer withdrew from the $33 billion merger over problems with the deal’s tax treatment and after a collapse in commodity prices at the time that eroded projected deal synergies. Tulsa-based Williams maintained it had tried to forge ahead with the merger.

The combination would have created one of the world’s biggest energy infrastructure companies. Together, the two companies would have become the largest transporter of natural gas in the United States, they said when the deal was announced in 2015.

After years of lawsuits and countersuits, Delaware Chancery Court Judge Sam Glasscock III concluded Wednesday that...