The German government threw Air Berlin a lifeline after the country’s second largest airline filed for bankruptcy due to its biggest shareholder, Etihad Airways, pulling the plug.

With the general election looming, the German government quickly stumped up a €150 million ($175 million) loan to at least temporarily safeguard some of the 8,500 jobs at stake and avoid angry Germans being stranded abroad, had the airline grounded its planes. Air Berlin now has enough cash to keep it in the air for the next three months while it tries to find a buyer.

A transport ministry spokesman said tens of thousands of holiday-makers are right now in different international destinations and “the return of these travelers to Germany with Air Berlin would otherwise not have been possible [without the loan].”

Since taking a 29% stake in 2011, Abu Dhabi-based Etihad has poured an estimated $2 billion into Air Berlin. But the airline has racked up around €2.4 billion ($2.8 billion) of losses over the past decade.

CEO Thomas Winkelmann on Wednesday blamed the delay in opening the new Berlin international airport for Air Berlin’s failure—it was supposed to open in 2011 and still has no clear opening day.

Despite flying around 2 million passengers a month, the airline has been also battered by Europe’s biggest low-cost carriers Ryanair and Easyjet. A restructuring plan last September, which included renting out planes and crew to Lufthansa and slashing jobs, wasn’t enough to turn it around.

Lufthansa and Easyjet are now reportedly looking to buy parts of Air Berlin. “Lufthansa has played a canny waiting game over a number of years and is now well placed to cherrypick those parts of Air Berlin’s operation that suit it best without buying the whole loss-making enterprise.” Jonathan Wober from the CAPA Centre for Aviation told Reuters.

Aviation expert Heinrich Großbongardt said that Lufthansa stands to profit big-time from the demise of Air Berlin. “Not so much because it’s getting rid of its biggest rival, but because this bankruptcy could strengthen its low-cost subsidiary Eurowings,”Großbongardt told Der Spiegel (link in German) “If Eurowings takes over more planes from Air Berlin, it can grow much quicker.”

Ryanair is not happy about Lufthansa’s interest in Air Berlin and the German government’s temporary loan. It immediately filed a formal complaint to the European Commission and German competition regulator accusing the German government and its national carrier of ignoring anti-trust laws and conspiring to carve up the airline between them.