SAS SAS.ST and pilot unions have reached a wage deal, the Scandinavian airline confirmed on Tuesday, ending a 15-day strike over a new collective bargaining agreement that had grounded 3,700 flights and put the carrier’s future in doubt.

Shares in SAS rose more than 12% in early morning trade. They are still down about a third since the beginning of the year.

SAS and a union representing its pilots had said late on Monday that a deal was close.

The airline, which filed for U.S. bankruptcy protection on the second day of the strike, said the industrial action had cost it more than $145 million to date and affected 380,000 passengers in the peak summer travel season.

The deal will allow the airline to finalise plans in the next few weeks to raise $700 million of fresh financing needed to see it through the bankruptcy protection process, it said.

The airline also said the new 5-1/2-year deal with four pilot unions would help it achieve part of the $700 million of annual cost savings set out in a business transformation plan, known as SAS FORWARD, that also includes measures such as handing back unwanted planes to lessors.

Even before the pandemic hit, SAS, which has branded itself as a premium airline, was losing money amid rising competition from low-cost carriers.

“I have good hope that they find the position in the market for the future, as a quality airline,” investor Gerald Engstrom, who has a 0.96% stake in SAS, told Reuters.

“Because SAS cannot be the cheapest, not even with those improvements. So they need to find a type of Lufthansa, British Airways style of doing this.

Wallenberg Investments, SAS’s third-biggest shareholder with a 3.4% stake, said it viewed the agreement positively as did government ministers in Denmark and Sweden, each of which has a 21.8% stake in the airline.

Danish Finance Minister Nicolai Wammen told Reuters all parties involved now needed to “make adequate contributions” as SAS implemented its transformation plan.

Denmark has pledged to write off some of SAS’ debt and convert some more into equity, as well as to inject new cash, if private investors participate too. Sweden backs a debt conversion but says no to injecting more cash.

The labour strife was the latest across Europe’s aviation sector as millions of workers struggle with rising costs of living, prompting trade unions to demand wage increases and stage walkouts, disrupting travel.

“Finally, we can resume normal operations and fly our customers on their much longed-for summer holidays,” SAS Chief Executive Anko van der Werff said in a statement. “I deeply regret that so many of our passengers have been impacted by this strike.”

Some flight disruptions will continue while the airline works to resume normal traffic, the company said.

REHIRING PILOTS

SAS said the agreement with pilots involved higher productivity, increased flexibility in seasonal capacity and a commitment, as operations ramp up until 2024, to rehire 450 pilots laid off during the pandemic.

Pilots had agreed to around 25% cut in wages as well as up to 60 working hours per week, up from the current 47, chairman of the Danish pilot union, Henrik Thyregod, told Danish broadcasters DR and TV2.

SAS had also met a key demand from unions had been that the laid-off pilots be rehired and shouldn’t have to compete with external applicants for jobs with less attractive terms at newly started subsidiaries SAS Link and Ireland-based SAS Connect, Swedish Air Line Pilots Association said in a statement.

SAS confirmed on Tuesday the new agreement would apply to Link and Connect pilots as well, without specifying further.

“The pilots have received a guarantee that they are part of the future of SAS, and that SAS will not establish new subsidiaries on terms other than those agreed with the Danish Pilot Association,” union Dansk Metal, which counts the Danish pilot union as a member, said in a statement.

The deal remained subject to approval by unions and a U.S. federal court, which is expected within a few weeks, SAS said.