(Reuters) -Spirit Airlines Inc on Thursday agreed to a $3.8 billion buyout offer from low-cost rival JetBlue Airways Corp, ending a drawn-out battle for the carrier whose acquisition would help create the fifth-largest U.S. airline.

The victory for JetBlue comes after Spirit canceled its $2.7 billion sale to Frontier Group Holdings, but the potential combination is expected to kick off a fight with antitrust regulators.

JetBlue’s offer price of at least $33.50 per share represents a premium of nearly 38% to the last closing price of Spirit shares. Including a “ticking fee”, or small monthly payments to Spirit shareholders from January next year until the deal is completed, the offer can go up to $34.15 per share.

Spirit shares were up nearly 5% before the bell as investors cheered the end of a takeover saga that began in April.

JetBlue rose 1%, while Frontier was 1.6% higher.

Both carriers were locked in a bidding war to create a combined airline that will better compete with legacy U.S. carriers at a time when the industry faces a labor crunch and high jet fuel costs.

Spirit had in February agreed to a $2.9 billion offer from Frontier before JetBlue jumped into the fray with in April. Despite JetBlue’s better terms, Spirit had pushed for a merger with Bill Franke backed-Frontier, citing antitrust concerns with a potential JetBlue tie-up.

But it could not muster investor support for the deal and was forced to delay a shareholder vote on the proposed acquisition four times. At the latest meet that was set for Thursday, Spirit shareholders were expected to vote against a merger with Frontier, Reuters had reported.

Spirit canceled the merger with Frontier without giving details on results of the shareholder meet.

The outcome is a setback for Franke, who was instrumental in starting the talks with Spirit last year. Franke’s airline-focused buyout firm, Indigo Partners, is a major shareholder in Frontier.

(Reporting by Abhijith Ganapavaram in Bengaluru; Editing by Arun Koyyur and Aditya Soni)