A group of SunEdison lenders took control of the renewable energy developer after inking a “sweetheart deal” to try to save their investment as the company approached bankruptcy, hurting other creditors, according to a lawsuit filed late Thursday in U.S. bankruptcy court.
SunEdison (sune) transferred “hundreds of millions of dollars” to the lenders, which included buyout firms Apollo Global Management and Cerberus Capital Management and more than 15 hedge funds, before it filed for bankruptcy, hurting the company’s other creditors, according to a redacted version of the complaint. A full copy was filed under seal.
SunEdison’s unsecured creditors, including Vivint Solar, filed the lawsuit. Vivint Solar had planned a $2.2 billion merger with SunEdison, but the deal collapsed earlier this year.
Get Data Sheet, Fortune’s technology newsletter.
A call to a SunEdison spokesman was not immediately returned. Cerberus and Apollo had no comment.
The unsecured creditors are asking a U.S. bankruptcy judge to limit how much the lenders can recoup on their investment.
The lawsuit comes as SunEdison looks to sell its shares in its sister companies TerraForm Global and TerraForm Power. A deal for these so-called “yieldcos” has yet to take shape. It could be a sale of the companies or of the renewable assets they hold, a person familiar with the matter said last week.
A less-likely option is the reorganization of SunEdison around its controlling shares in the companies, the person said.
Why Is Wall Street Not in Love With Solar Energy?
SunEdison, whose bankruptcy was the biggest of 2016 to date, has not yet filed its plan of reorganization with the court.
The lawsuit focuses on a January $950 million “sweetheart deal” that also enhanced collateral for other lenders. SunEdison finalized the deal hoping to “put off the day of reckoning” and “hide failed business strategy and mismanagement,” the suit says.
According to the complaint, the secured lenders forced SunEdison to wait three months and 10 days to file for bankruptcy in late April to confirm that the collateral backing their investments would be secure under bankruptcy rules.
The lenders decided to take this tactic after the January deal was finalized and they realized the extent of financial distress at SunEdison, the complaint states.
One group of lenders targeted by the lawsuit helped protect their investment in the company’s bankruptcy loan.
SunEdison once had a market capitalization of nearly $10 billion, but the bankruptcy judge overseeing the case has called the company “hopelessly insolvent.”