Deutsche Bank recently said that the worst is over for Anadarko Petroleum (NYSE:APC).

Ever since U.S. Bankruptcy Judge Allan Gropper ruled on Dec. 12  that Anadarko's Kerr-McGee unit needed to pay for environmental cleanup caused by its spinoff of Tronox, there have been clouds growing over the Woodland, TX,company.

Because of the court ruling, Anadarko is now liable for anywhere between $5 billion to $14 billion in environmental cleanup costs. The upper bound of $14 billion was substantially greater than analyst expectations and was the primary reason why Anadarko shed a significant part of its market capitalization.

Parallel to Macondo
The Tronox ruling for Anadarko is a lot like the 2010 Macondo spill for BP (NYSE:BP). Like Anadarko, BP had a resulting large legal liability. BP has so far set aside $42 billion to cover up the fines, clean-up, and other costs for the Macondo oil spill. 

That large legal uncertainty caused BP's stock to significantly underperform peers like ExxonMobil (NYSE:XOM) and Chevron (NYSE:CVX)and trade in a tight range between $35 and $48 for two years while the company divested many of its non-core assets to shore up its balance sheet. 

I believe the story with Anadarko is going to play out in a similar fashion, but without the stock taking as much of a beating. 

Like BP, the legal liability will likely make Anadarko less aggressive in making capital investments and could spur the company to sell some of its portfolio to fund its potential liabilities.

Unlike BP in 2010, when the British company faced a liquidity crisis and cancelled its dividend, Anadarko has $7 billion in cash and can access liquidity through debt offerings. Because of the appeals process, the liability ruling is not an immediate expense and is unlikely to cause the company to cancel its dividend. This removes the forced pension fund liquidation scenario that BP underwent in 2010. 

The bottom line
The recent legal trouble for Anardarko creates an interesting situation for new long-term investors.

Despite its recent legal troubles, Anardarko is still a quality company. Its net asset value is significantly higher than its current market price. Anardarko has many attractive assets around the globe. The company has deepwater offshore assets in the Gulf of Mexico and Africa, as well as projects in the Wattenberg Field, Eagle Ford, and Brazil. It is still targeting annual production growth of 5% to 7% in the next decade.

New long-term investors benefit from the legal ruling because if Anardarko falls significantly, there will likely be a buyout offer from a larger firm, offering a free out for investors.

According to Oppenheimer's Fadel Gheit, both ExxonMobil and Chevron may be interested in acquiring Anadarko.

Unlike BP, which at its lowest point still traded at a substantial enterprise value, Anadarko, at $50 billion in enterprise value, is small enough for companies like ExxonMobil or Chevron to buy.

It may also be a good deal for the acquirer. The company is currently trading at only 5.4 times 2014 enterprise value/debt-adjusted cash flow. In my opinion, Deutsche Bank is right in that there is limited downside. It may be range-bound in the near future, but the long-term upside is still very attractive.