Energy traders found some cause for celebration at the end of this long, disastrous year.

California -- which has long painted energy traders as greedy villains -- declared peace Tuesday with a former major foe. The state formally ended its standoff with Williams ( WMB) by finalizing a settlement package, valued at $1.64 billion, with the Tulsa-based company.

Under the settlement, California stands to save up to $1.4 billion -- or 32% -- on a $4.3 billion long-term power contract inked with Williams at the height of the state's power crisis in 2001. The settlement also calls for Williams to pay $150 million in cash over the next eight years and turn over six generating turbines, valued at $90 million, to settle lawsuits accusing the company of unfair business practices.

For Williams -- a one-time giant struggling to rebuild -- the peace is worth the price.

"This agreement removes significant uncertainty from our company and preserves substantial value in our California energy contracts," Williams CEO Steve Malcolm said in announcing the finalized deal on Tuesday. "The agreement is an important step toward our goal of reducing the financial risk and liquidity requirements related to our energy marketing and risk management business."

Williams investors, delighted by the news, started their New Year's Eve celebration early. They sent the stock shooting to a $2.70 close, following a 19% gain for the day.

The rally swept up other troubled energy companies as well. Dynegy ( DYN), which joined Williams in a close brush with bankruptcy earlier this year, jumped 16% to $1.18. Aquila ( ILA) and Mirant ( MIR) also tacked on gains of more than 5%.

Even so, the entire sector has a long way to go before it can recover the billions of dollars in market capitalization it lost during this tumultuous year.

But Williams, with its usual optimism, predicted brighter days ahead.

"Ending the year with a finalized, favorable agreement with California is a major achievement for our company," Malcolm said. "This agreement, combined with significant financial progress, provides momentum for us to move forward in 2003."

Climb Every Mountain

Another troubled energy company -- Allegheny Energy ( AYE) -- also benefited from some positive end-of-the-year news. The company, faced with a Dec. 31 refinancing deadline, secured a third extension from its lenders on Tuesday. It now has two more weeks to pound out a $2 billion financing package needed to meet its debt and business obligations.

Between now and then, Allegheny said, the company must work to address outstanding defaults and amendments to existing facilities -- which could include a restrictive bond indenture examined by TheStreet.com last week. Absent success on these fronts, the company's future could look grim.

"As the company noted earlier this month," Allegheny stated Tuesday, "if it is unable to successfully complete negotiations with these lenders, including arrangements with respect to inter-creditor issues, it would likely be obliged to seek bankruptcy protection."

Investors, relieved by a fresh bit of breathing room, pushed shares of Allegheny higher. The stock climbed 4.3% to end the year's last session at $7.56. Still, the stock commands only 20% of the price it fetched when 2002 began.