JetBlue Airways and Spirit Airlines have reached an agreement for the former to acquire the latter for $3.8 billion. The deal, which was announced Thursday morning according to CNBC, would lead to the creation of the fifth-largest airline in the United States. 

For months, there has been an ongoing bidding war between JetBlue and Frontier. Spirit announced its intention to merge with Frontier in February. However, in April, a surprise cash bid came in from JetBlue, disrupting Spirit-Frontier merger plans.

The two airlines competed, continuing to enhance their offers. The Frontier plans were finally laid to rest due to Spirit not having the shareholder support to ultimately obtain approval for the deal. 

JetBlue has agreed to pay $33.50 per share in cash for Spirit. Now Spirit seeks approval for the JetBlue takeover, which, if given the green light by legislators, will leave Frontier as the country’s largest budget airline. 

Initially, JetBlue’s bids were rejected, as Spirit deemed the merger to be unlikely to attain approval primarily due to JetBlue’s alliance with American Airlines. Last year, the Justice Department sued to block the alliance.

If it goes through, the agreement will be the first major US air carrier deal since Alaska Airlines acquired Virgin America for $4 billion in April 2016. Analysts believe the acquisition could also set the stage for more mergers between smaller airlines.

According to CNBC, “JetBlue executives say that buying Spirit would fast-track its growth by giving it access to more Airbus jetliners and pilots and help it compete with large carriers like American, Delta, United and Southwest, which control most of the U.S. market.”

“The New York-based carrier plans to refurbish Spirit’s yellow planes with sparse interiors in JetBlue style, featuring seatback screens and more legroom.”

Related: Frontier And Spirit Airlines Merger Will Create The Ultimate Low-Fare Airline