After a strong run in its first several years as a public company, Spirit Airlines (SAVE 6.46%) has disappointed investors again and again since 2015. Yet while profitability has been receding, the carrier continued to exceed its long-term goal of generating "mid-teens or higher operating margins" -- until now.

Unfortunately, a damaging dispute with its pilots and an industry price war sparked by United Continental (UAL -1.82%) have undermined Spirit Airlines' margin performance recently. Let's take a look at what this means for the company's long-term prospects.

Spirit Airlines' profit margin comes back to earth

For most of the past three years, Spirit Airlines has faced severe unit revenue pressure, as rivals have become more aggressive about matching its low fares. Nevertheless, its adjusted operating margin peaked in 2015 at 23.7%, thanks to the benefit of lower fuel prices.

A Spirit Airlines plane at its gate

Just two years ago, Spirit Airlines posted a record profit. Image source: Spirit Airlines.

Fuel prices fell again in 2016, but this time it wasn't enough to offset the impact of declining unit revenue. As a result, Spirit's adjusted operating margin slipped to 20.9%. However, this was still well above the company's long-term target.

During the first half of 2017, margin performance deteriorated at an even faster rate. For the 12 months ending in June, Spirit Airlines' operating margin fell to 17.5%. This included a roughly $45 million headwind from flight cancellations caused by the pilot dispute during May and June.

The retreat becomes a rout

While pilot-related flight cancellations constrained Spirit's profitability in Q2, the silver lining was that revenue per available seat mile (RASM) rose 5.7% for the quarter. This represented the first unit revenue increase at Spirit Airlines since 2014.

This revenue momentum didn't last long, though. Beginning in late June, Spirit experienced a wave of deep discounting by competitors -- chiefly United Airlines -- in several key markets. As a result, in late July, Spirit Airlines projected that RASM would decline 2%-4% this quarter.

The fare war has accelerated since then. Additionally, Hurricane Harvey created an incremental 1-percentage-point RASM headwind. This led Spirit to slash its guidance in early September. The company now expects RASM to plunge 7%-8.5% this quarter, and that doesn't even include the impact of Hurricane Irma, which may have caused an even greater revenue loss than Harvey.

With jet fuel prices on the rise once again, Spirit Airlines' profit margin could fall by about 10 percentage points relative to the 23% adjusted operating margin it posted in the year-ago period. Barring a rapid turnaround next quarter, the company will fall short of a 15% full-year operating margin this year, for the first time since 2012.

Is 2017 an anomaly?

Analysts expect Spirit Airlines to generate revenue of about $2.6 billion in 2017. If it were to achieve its long-term margin guidance this year, it would likely earn about $200 million-$250 million after tax. Considering Spirit's enormous growth opportunities, the company's $2.4 billion market cap seems far too low -- if its margin target is achievable in the long run.

However, as noted above, Spirit Airlines is likely to fall short of its margin goal in 2017. The carrier is also benefiting somewhat from its outdated pilot contract. Spirit's pilots are due for big raises, which will probably increase costs by at least $100 million annually. If those raises had been in force from the beginning of 2017, Spirit Airlines would be on track to miss its margin target by an even greater amount.

On the other hand, had a new pilot contract been in place earlier this year, Spirit Airlines could have avoided the damaging wave of pilot-related flight cancellations that peaked in May. Better operational performance could partially offset the impact of higher pilot wages on unit costs.

Additionally, in the long run, Spirit Airlines can react to competitive trends by adjusting its route network and pricing strategy. (In the short run, it has fewer tools at its disposal.) It has already begun to shift its focus toward midsize leisure markets like New Orleans, where competition isn't quite so brutal.

United Continental's price-matching strategy may backfire

It's too early to know whether, with enough time, Spirit Airlines would be able to offset fuel and labor cost pressure through unit revenue growth in the current competitive environment. Perhaps another year or two of route network restructuring would do the trick, but it's also possible that Spirit would eventually face vicious competition in any market it tried to enter.

A United Airlines plane

Price-matching by United Airlines has undermined Spirit's profitability. Image source: United Airlines.

However, the current climate of intense competition seems unsustainable. Earlier this month, United Continental slashed its third-quarter guidance. It now expects to post a mediocre pre-tax margin of 8%-10% in what has traditionally been its most profitable quarter of the year.

Some of this margin pressure does stem from one-time factors. However, the underlying unit revenue pressure could get worse during the upcoming off-peak season, when it is harder to stimulate demand. To make matters worse, United will face increased competition from low-fare carriers on numerous important routes over the next few quarters.

For the moment, United's management team appears to be committed to a policy of aggressive price-matching. However, a few more quarters of severe margin declines could force United's top leaders to change their tune.

Spirit Airlines enjoys a massive cost advantage over legacy carriers like United Continental. As a result, it is in better position to weather a price war than United itself. Indeed, based on the rapid margin erosion it is already facing, United Continental may have to abandon its aggressive price-matching activity before the end of 2018. This would likely allow Spirit's profitability to recover -- making Spirit Airlines stock a great buy at its current depressed valuation.