Spirit Airlines is in talks with alternative investment firm Castlelake for a potential takeover as the discount airline looks for a path out of bankruptcy, CNBC has learned.

Spirit filed for Chapter 11 bankruptcy protection last August for the second time in a year after its previous turnaround plan fell flat.

Fellow budget carrier Frontier Airlines

had been in talks with Spirit over the years for a potential merger, including in recent months, but didn’t secure a deal, according to people familiar with the matter, who requested anonymity to speak about the discussions. The two had reached a deal four years ago but it was called off after a surprise all-cash offer from JetBlue Airways

Spirit and Castlelake didn’t immediately respond to requests for comment.