JetBlue Airways has agreed to buy Spirit Airlines for $3.8 billion and create the nation's fifth-largest airline if the deal can win approval from antitrust regulators.

The agreement Thursday capped a months-long bidding war and arrives one day after Spirit's attempt to merge with fellow budget carrier Frontier Airlines fell apart.

Spirit CEO Ted Christie is being thrust into the awkward position of defending a sale to JetBlue after arguing vehemently against it, saying that antitrust regulators would never let it happen.

"A lot has been said over the last few months obviously, always with our stakeholders in mind," Christie said on CNBC. "We have been listening to the folks at JetBlue, and they have a lot of good thoughts on their plans for that."

JetBlue's case for regulatory approval rests on two main arguments: That its size makes it better positioned to force bigger airlines to reduce fares; and that it has already volunteered to give up Spirit gates and takeoff and landing slots at key airports in New York, Boston and Florida.

JetBlue CEO Robin Hayes said those concessions will let other low-cost carriers, including Frontier, bolster their presence and thus increase competition.

"The real issue here though is clearly what can we do in the U.S. to make a more competitive airline industry against the large, big four airlines," Hayes said in an interview. "We believe the most disruptive, the most effective thing that we can do is build a bigger JetBlue more quickly than we otherwise could."

Together, JetBlue and Spirit would have about 9% of the U.S. air-travel market. American, United, Delta and Southwest control about 80% when international flights are included.

Hayes said Spirit planes will be converted to JetBlue's configuration, which allows for more legroom and means there will be fewer seats for sale on each flight. He said JetBlue will increase the pay of Spirit employees.

JetBlue and Spirit have been talking for the past several weeks, mostly about things such as how Spirit can retain key employees while its fate is up in the air. The financial terms of the deal did not change after early July.

Shares of Spirit, based in Miramar, Florida, rose 4% in midday trading Thursday, to $25.31, still below the price that JetBlue is offering. JetBlue shares slipped 2%, and Frontier — seen as benefiting if Spirit disappears as a discount competitor — jumped 19%.

Spirit Airlines regularly ends up as the worst, or close to the worst, when airlines are ranked by the rate of consumer complaints. Still, some consumer advocates worry that fares will rise if it disappears.

Spirit and similar rivals Frontier and Allegiant charge rock-bottom fares that appeal to the most budget-conscious leisure travelers, although they tack on more fees that can raise the cost of flying.

"Spirit is going to disappear, and with it, its low cost structure," said William McGee of the anti-merger American Economic Liberties Project. "Once Spirit is absorbed [into JetBlue], there is no question that fares are going to go up."

Others, however, say that Frontier will grow — it has a large number of planes on order — and fill any gap left by Spirit in the cheapest segment of the air-travel market.

JetBlue and Spirit will continue to operate independently until the agreement is approved by regulators and Spirit shareholders, with their separate loyalty programs and customer accounts.

The companies said they expect to conclude the regulatory process and close the transaction no later than the first half of 2024. If that happens, the combined airline would be based in JetBlue's hometown of New York and led by Hayes. It would have a fleet of 458 planes.

JetBlue said Thursday that it would pay $33.50 per share in cash for Spirit, including a prepayment of $2.50 per share in cash payable once Spirit stockholders approve the transaction. There is also a ticking fee of 10 cents per share each month starting in January 2023 through closing to compensate Spirit shareholders for any delay in winning regulatory approval.

If the deal doesn't close due to antitrust reasons, JetBlue will pay Spirit a reverse break-up fee of $70 million and pay Spirit shareholders $400 million, minus any amounts paid to the shareholders prior to termination.

Spirit and Frontier announced their plan to merge in February, and Spirit's board stood by that deal even after JetBlue made a higher-priced offer in April. However, Spirit's board could never convince the airline's shareholders to go along. A vote on the merger was postponed four times, then cut short Wednesday when Spirit and Frontier announced they were terminating their agreement, which made a Spirit-JetBlue coupling inevitable.

JetBlue anticipates $600 million to $700 million in annual savings once the transaction is complete. Annual revenue for the combined company is anticipated to be about $11.9 billion, based on 2019 revenues.

Copyright 2022 AP. All rights reserved. This material may not be published, broadcast, rewritten, or redistributed.