For an airline that has struggled for the best part of a decade, Air Berlin has managed to stick around for a surprisingly long time.

Although the writing has been on the wall since 2006’s lackluster IPO, which was followed by years of losses, it was kept afloat thanks to shareholder Etihad Airways, whose expansion attempts had seen it invest in a series of struggling European carriers.

With a new chief executive in Abu Dhabi, Etihad’s patience has finally run out, and, having had its funding pulled, Air Berlin had no choice but to file for bankruptcy.

The collapse of Germany’s second-largest airline will no doubt please its biggest, Lufthansa, and others with an interest such as TUI Group, Ryanair, and EasyJet.

These airlines have long complained about overcapacity in the German market. Several attempts to alleviate this problem have failed over the years.

“It’s been likely to happen for some time. A relatively high cost market for operators, excess capacity, falling yields, a distant unsupportive shareholder and let time take its course would seem to be the recipe for what has happened,” said aviation consultant John Grant.

Below is our analysis of what’s going on, what it means for European competition, and how we got here.

What happens next?

Instead of all its flights being grounded, Air Berlin has secured a bridge loan from the German government, so it will continue flying for the foreseeable future.

Had this loan not been forthcoming, thousands of passengers would have been stranded abroad in peak European holiday season.

Lufthansa has been trying to buy parts of Air Berlin for past year or so and in January was given clearance to lease some aircraft for its subsidiaries, including Eurowings. EasyJet is supposedly keen on acquiring some of Air Berlin, Reuters reported.

Lufthansa Group said in a statement: “Lufthansa is already in negotiations with Air Berlin to take-over parts of the Air Berlin Group and is exploring the possibility of hiring additional staff. Lufthansa intends to conclude these negotiations successfully in due time.”

Ryanair is also engaging in some strategy. The Irish airline might not be a great fit to acquire Air Berlin’s assets, because it flies Boeing aircraft, not Airbuses like Air Berlin. But it is already furious about the closeness of the German government and Lufthansa.

“This is clearly being set up for Lufthansa to take over Air Berlin which will be in breach of all known German and EU competition rule,” a Ryanair spokesman said. “Now even the German government is supporting this Lufthansa-led deal with €150m of state aid so that Lufthansa can acquire Air Berlin and drive domestic air fares in Germany even higher than they already are.”

Analysts at RBC said that any move by Lufthansa would be “defensive” as it would be “blocking other more competitive airlines from expanding.” RBC has also speculated that after Air Berlin, investor focus will move to Norwegian and Alitialia.

“In theory both may offer opportunity for consolidation and a more rational European backdrop,” RBC analysts noted.

Wasn’t Etihad Airways supposed to save Air Berlin?

That was the spin in 2011, when Etihad bought 29.2 percent of the struggling German airline, becoming its largest shareholder.

The idea was simple: Etihad would gain access to the lucrative German market, while Air Berlin would receive needed cash. Etihad also would lessen its dependence on revenue from the Middle East, where it fought for share with Emirates Airline and Qatar Airways. Etihad hoped the deal would help it win corporate customers in Germany.

But it hasn’t worked. Last year, Air Berlin reported 781 million euros in losses, or about $916 million U.S., its eighth loss in nine years. According to CAPA, an aviation analysis firm, the airline’s only profit came in 2012, after it sold its loyalty program to Etihad.

Instead of giving up, Etihad kept investing. In May, with the airline ailing, Bloomberg reported Etihad had invested another $350 million Euros, or about $410 million U.S., into Air Berlin. At the time, it was estimated Etihad had invested almost 2 billion Euros ($2.35 billion U.S.) into the company.

However, Air Berlin had some massive structural challenges, and they weren’t Etihad’s fault. One basic problem: The airline never settled on a strategy. For a long time, it wanted to be a discount airline focused on attracting leisure customers. But it never could get its costs to match other low-cost carriers in Europe.

In recent months, it changed course, saying it would focus on business passengers and on long-haul flights across to the Atlantic from Düsseldorf and Berlin. It’s a little early to judge the strategy, but the transatlantic market is difficult, with discounters like Norwegian Air and established legacy airlines fighting for the same passengers. Many European and U.S. airlines have anti-trust immunity with each other, allowing them to operate legal monopolies on lucrative routes, but Air Berlin does not have immunity with any U.S. carriers.

Etihad had hoped its cash infusion this spring would help Air Berlin stay solvent for long enough for the German airline to explore “strategic alternatives,” such as a sale.

“However, Air Berlin’s business has deteriorated at an unprecedented pace, preventing it from overcoming its significant challenges and from implementing alternative strategic solutions,” Etihad said in a statement Tuesday.

Etihad added that it had given up trying to prop up Air Berlin, saying it “cannot offer funding that would further increase our financial exposure.”

Did anyone see this coming?

Yes.

Industry insiders were repeatedly surprised by Etihad’s investments into struggling foreign carriers. Air Berlin was just one of them. Over a roughly five-year period, Etihad also bought stakes in Air Serbia, Air Seychelles, Alitalia, Jet Airways and Virgin Australia, usually owning 24 and 49 percent of the airline — not enough to run it.

Etihad’s former CEO, James Hogan — he was let go this year after it became apparent that this strategy was not working — hoped to create a fourth global airline alliance, led by Etihad. As an alternative to Etihad joining one of the established players — OneWorld, Star Alliance and SkyTeam — Hogan was building Etihad Airways Partners, a group of eight airlines with ties to Abu Dhabi.

None of the investments has been particularly successful, and some, including Air Berlin and Alitalia, have been disastrous. The Italian airline is also in bankruptcy, and in May, Etihad, which owned 49 percent of Alitalia, said it would no longer fund the airline.

Since almost the beginning of Etihad’s strategy, analysts have wondered whether the company was set for disaster, asking if Etihad would meet the same fate as Swissair. In the 1990s, Swissair, after receiving advice from the consulting firm McKinsey, bought pieces of several airlines, including South African Airways, Belgium’s Sabena, Poland’s LOT, and France’s Air Liberté.

Swissair had two things in common with Etihad. It bought less than controlling stakes, and it invested in weaker airlines. By 2002, Swissair had disappeared, replaced by Swiss International Air Lines, a company with a clean balance sheet. It is now owned by Lufthansa Group.

“Most people look at that and think the golden rule is either you control it or you don’t do it,” Andrew Charlton, managing director of Aviation Advocacy, a Geneva-based advisory firm, told the Wall Street Journal four years ago in a story asking if Etihad would meet the same fate as Swissair.

But in an 2013 interview with Flight Global, an industry publication, Hogan said he had little choice. Etihad’s home market, he noted, was small and competitive. The airline needed to branch out.

“My fiercest competitors are here in the Gulf,” Hogan said. “This strategy is part of how I differentiate and build a network to compete.”

How will Etihad Proceed?

Hogan was dismissed on July 1, and less than a month later, Etihad reported a massive $1.87 billion annual loss for 2016. About $800 million of the loss were attributable to failed investments in other airlines, especially Alitalia and Air Berlin, the company said.

Under interim CEO Ray Gammell, Etihad may try to reduce its investments in foreign carriers. It still hold stakes in six, though in July it sold its 33 percent piece of a Swiss regional airline to a private equity firm that also owns Slovenia’s Adria Airways. The airline is called Darwin Airline, but Etihad had rebranded it as Etihad Regional.

In announcing the deal, Etihad said it was conducting an “ongoing strategic review” of its investments.

But while it’s possible Etihad will seek to limit its investments abroad, the carrier’s home market is also in turmoil.

The airline has struggled as the global oil economy has slowed. Last month, when it announced earnings, it said fewer passengers were buying business class tickets because “corporate travel policies continued to encourage flyers to downgrade to Economy.” It also noted that yields — a rough measure of ticket prices – were under pressure in all cabins.

And Etihad’s brand in the United States has taken a hit recently, as the nation’s three largest carriers — American Airlines, Delta Air Lines and United Airlines — have engaged in a coordinated campaign to try to block it and its two Gulf neighbors, Emirates and Qatar Airways, from further U.S. expansion.

American, Delta and United argue Emirates, Qatar and Etihad are stealing their passengers — especially travelers bound for India, Africa and the Middle East. While U.S. airlines fly to few destinations in those regions, they share revenue with European airlines that do. For example, American makes money if a traveler flies from Los Angeles to London on American, and then onto New Delhi on British Airways.

The U.S. majors allege the three Gulf airlines receive subsidies from their governments, which they say is a violation of Open Skies agreements negotiated by the United States with Qatar and the United Arab Emirates. The agreements permit Gulf carriers to launch as many U.S. flights as they want, but they bar most government subsidies.

The Gulf carriers deny the charges. Like all airlines, they say, they receive government assistance. But it is not illegal, they insist.