NEW YORK (CNNMoney.com) -- Even as BP appears poised to permanently kill its blown-out well in the Gulf of Mexico, shares of the company have hit a wall as investors turn their attention to the massive legal costs that lie ahead for the energy giant.
BP has pledged to set aside $20 billion to compensate businesses and individuals hurt by the worst offshore oil spill in history. But analysts say the costs associated with the hundreds of lawsuits the company is facing could far exceed that amount.
"There's so much uncertainty around the legal implications," said Alex Morris, an analyst at Raymond James. "I'm not sure how much more room it has left to run," he said about the stock.
After hitting a low near $27 in late June, shares of BP had rebounded some 50% to trade above $41 a share earlier this month. But the stock has fallen 6% in the past few days to below $39.
BP is currently facing about 300 civil lawsuits brought by fishermen, hotel owners and oil industry workers, which could take years to resolve. The company could be hit with hundreds more cases, including criminal charges, if it is found guilty of gross negligence.
"The logistical challenge itself is breathtaking," said Scott Giordano, corporate counsel at Mitratech, a consulting group specializing in legal operations. "They are in for an enormous amount of cost."
The worries about BP's legal costs come despite a number of positive developments, including the successful capping of the well last month and the expected completion of a relief well this week.
BP also named Robert Dudley, an American, to replace the maligned Tony Hayward as chief executive officer. In addition, government scientists recently issued a report estimating that most of the oil in the Gulf has been cleaned up or biodegraded.
But the outlook for the stock remains mired by questions about the ultimate financial toll of the spill.
"Yes, some uncertainty seems to have been eliminated," said Mark Gilman, an analyst at The Benchmark Company. "But the liability portion of it is still up in the air, as well as the degree to which it will be shared by partners."
Some of the costs related to the spill could be paid by BP's non-operating partners Anadarko Petroleum (APC, Fortune 500), which owns 25% of the broken well, and Mitsui Oil Exploration, which owns 10%. But those companies could be off the hook if the courts determine that BP was grossly negligent.
Investors are also worried the Gulf spill could make it harder for BP to win drilling contracts in other regions of the world. But Gilman downplayed those concerns, saying BP is an industry leader when it comes to technical expertise, particularly in deepwater drilling.
Despite the uncertainty hanging over the stock, some analysts say BP is well positioned for the future.
"I think the stock still a far cry from where it should be trading based on fundamentals," said Fadel Gheit, an analyst at Oppenheimer & Co., adding that he thinks the stock is worth about $59 a share.
He said the asset sales BP has planed to cover costs related to the spill should not undermine the company's long-term prospects. Even after it sells the $30 billion worth of assets, BP will still be the second largest oil and gas company in the world after Exxon Mobil (XOM, Fortune 500), according to Gheit.
In its most recent quarterly financial statement, BP reported a $32.2 billion charge for costs related to the spill, including the $20 billion it has set aside to pay damages. The charge, the company said, is based on the assumption that BP was not grossly negligent.
However, if that assumption turns out to be wrong, the costs to BP could more than double, Gheit said.
It's no wonder that investors aren't completely convinced that BP is out of the woods just yet.
The Facebook COO looks back on her first year as a single mom and rethinks some of 'Lean In.' More