Airline stocks enjoyed a huge rally in 2013, and the gains have continued in 2014. At of the beginning of this week, American Airlines (AAL -2.18%) had gained more than 70% this year. Delta Air Lines (DAL -2.62%) and Southwest Airlines (LUV -0.54%) had impressive 45%-55% gains, too. Even industry laggard United Continental (UAL -2.52%) had a solid 25% gain.

UAL Chart

YTD Airline Stock Price Chart, data by YCharts

This week, the airlines hit a big rut. Between Wednesday and Thursday, most major airline stocks dropped at least 10%. Ironically, this came soon after a series of airlines reported strong unit revenue numbers, indicating a robust demand environment.

However, investors have become concerned about the potential for an oil price spike due to a rising (and so far, successful) insurgency in Iraq -- a major oil exporter. A big profit warning from top European carrier Lufthansa made matters worse. The drop in airline stock prices may be creating a buying opportunity: at least for Delta Air Lines and Southwest Airlines.

Unit revenue rising
Of the top four U.S. airlines, only Delta and Southwest continue to report monthly unit revenue statistics. For May, both of these carriers reported excellent numbers. At Delta, unit revenue rose about 7% on a 3.6% increase in system capacity.

Delta reported very strong unit revenue results for May. Photo: The Motley Fool

Meanwhile, capacity fell 1.5% at Southwest, but unit revenue improved an even more impressive 8%-9%. The increases at Delta and Southwest are particularly impressive because both carriers are shifting their fleet mixes toward larger planes, which tends to hurt unit revenue (but reduces unit costs).

American Airlines no longer reports monthly unit revenue statistics, but it does offer a monthly update to its unit revenue guidance for the full quarter. One month ago, American's management team was projecting a 4%-6% increase in unit revenue during Q2. Last week, they updated that guidance and are now projecting a 5%-7% unit revenue gain this quarter.

Clouds on the horizon?
Despite these strong signals from three of the top four U.S. carriers, investors are becoming transfixed by a few clouds on the horizon. First came Lufthansa's profit warning. The top German carrier told investors that operating profit in 2014 and 2015 would be 25%-35% lower than previously expected. This news had a big impact on the stocks of all three legacy carriers: American, Delta, and United.

Lufthansa blamed the shortfall primarily on increased competition from Middle Eastern carriers, which is depressing ticket prices for long-haul routes. However, the growth of airlines like Emirates won't hurt U.S. carriers nearly as much as their European kin, simply because Dubai is 7,000-8,000 miles from most of the U.S. but only 3,000 miles from Germany.

However, Lufthansa's warning is still bad news for United Continental shareholders. United and Lufthansa have a joint venture for transatlantic flights (along with several other carriers). United, Lufthansa, and their other alliance partners share revenue from their transatlantic flights in proportion to how much capacity each airline provides.

United Continental's transatlantic joint venture with Lufthansa could be a liability this year. Photo: The Motley Fool

If some of the revenue decline at Lufthansa is attributable to transatlantic traffic (e.g. customers flying from North America to Europe, Africa, India, or the Middle East), then United will also be penalized. It will receive less revenue from the joint venture for any given level of transatlantic capacity.

Fuel prices could spike
Investors are also worried about the growing unrest in Iraq, which the Iraqi government and army so far seems powerless to stop. Any major disruption in exports from the OPEC cartel's second-largest oil producer would have a significant impact on the global supply/demand balance.

Fortunately, the main oil producing areas of Iraq are in the south, where most people are loyal to the government rather than the insurgent groups. Still, the situation is in flux, and so the price of Brent crude has climbed by about $5 per barrel (or $0.12 per gallon) this week.

American, Delta, and United each consume about 4 billion gallons of jet fuel annually. Thus, this price increase alone could have a pre-tax impact of nearly $500 million for each carrier (before the effect of any fuel hedges in place). At Southwest, the impact would be a little less than half of that amount.

That said, all four top U.S. carriers are expected to earn at least $1 billion in 2014. If oil prices continue to rise, they should also have the ability to raise fares to recoup some of the increased cost. Unless prices go much higher than they have so far, U.S. airlines should be able to weather this storm.

This could be a buying opportunity
The sudden weakness in airline stock prices could represent a good buying opportunity. Delta and Southwest remain the more attractive picks among the top four airlines. Both companies have solid balance sheets and strong free cash flow, which allows them to pursue shareholder-friendly actions like dividends and share buybacks.

Strong cash flow and a solid balance sheet makes Southwest a good stock for long-term investors. Photo: The Motley Fool

American Airlines and United Continental look less attractive. American has huge capital commitments to update its fleet, and expects CapEx spending to remain around $5.5 billion/year for the next five years. This will hamstring its ability to maintain a significant dividend or buyback program in the near future.

United's position is even worse -- its profit margin lags the rest of the airline industry badly. This means that a rise in oil prices could have a bigger percentage impact on its earnings. Revenue issues at United's joint venture partner Lufthansa are just one more reason to sell.