Troubled airline Virgin Atlantic has finalised a rescue deal worth £1.2bn that should protect thousands of jobs.
Sir Richard Branson's Virgin Group will inject £200m, with additional funds provided by investors and creditors.
The billionaire Virgin boss had a request for government money rejected, leaving the airline in a race against time to secure new investment.
Virgin Atlantic is cutting 3,500 staff, but the airline said the remaining 6,500 jobs should be secure.
The deal includes funding from US hedge fund Davidson Kempner Capital Management, and the postponement of about £450m in payments to creditors. Virgin Group owns 51% of the airline, with the rest held by US carrier Delta Air Lines.
Virgin Atlantic said the refinancing covered the next five years and paved the way for it to rebuild its balance sheet and return to profitability in 2022.
"We have taken painful measures, but we have accomplished what many thought impossible," said chief executive Shai Weiss. "The last six months have been the toughest we have faced in our 36-year history."
As with other airlines, the Covid-19 outbreak plunged Virgin Atlantic into a crisis as air travel dried up. Virgin grounded most of its fleet for months, but is due to resume some services next week.
The company had initially hoped the government would step in with up to £500m in bailout loans, but ministers made it clear taxpayers' money could only be considered once all other options had been exhausted.
Sir Richard even offered to mortgage his Caribbean holiday island, Necker, in return for new investment, although this was no longer necessary. Virgin Group raised money for the investment from the sale of some shares in the Virgin Galactic space tourism company.
The investment plan still needs formal approval from Virgin Atlantic's creditors under a court-sanctioned process.
In May, the airline announced 3,500 job cuts and the closure of its base at Gatwick airport. Although the restructuring and investment plans protect the remaining jobs, it does not change the need to re-shape the size of the business, Virgin Atlantic said.
Virgin Atlantic calls this a "solvent recapitalisation". But the question is, will it be enough to secure the company's long-term future?
There is some new money here - an extra £200m in cash from the Virgin Group and loans worth £170m from Davidson Kempner. But a large part of the package is made up of deferring or waiving existing liabilities.
This was probably the best the company could do in the circumstances, after the government made it clear targeted state aid would only be considered as a last resort, after private-sector options had been exhausted.
But it doesn't seem to give the company much of a war chest to absorb future shocks. It is due to resume flights next week - and managers will be desperate for demand to pick up, and quickly.
Virgin Atlantic has already taken drastic action to cut costs, shedding more than 3,500 staff and closing its base at London Gatwick. There's no doubt it will be a much leaner operation in future.
This deal does at least keep the airline flying, but navigating its way through the stormy skies facing the industry for the foreseeable future will still be a huge challenge.
Virgin insiders say the company has wargamed the worst-case scenario, which is a failure of transatlantic flights to recover, and it still reckons this deal will be enough to keep Virgin in the air.
On Tuesday, Delta Air Lines wrote down the value of its stake in Virgin Atlantic, taking a $200m (£160m) charge. The giant US airline also reported an adjusted pre-tax loss of $3.9bn, saying it was burning through cash at a rate of $27m per day.
Ed Bastian, Delta's chief executive officer said. "Given the combined effects of the pandemic and associated financial impact on the global economy, we continue to believe that it will be more than two years before we see a sustainable recovery."
Last month, Mr Bastian told the BBC: "We're not planning on injecting additional capital into Virgin. We're supporting them in doing everything we can, helping them through a restructuring, hopefully to avoid an in-court process, and I'm still optimistic, cautiously optimistic that we'll be able to get there."
Aviation firms have been battered by the coronavirus crisis. On Tuesday, Ryanair said it would cut 1,000 flights between Ireland and the UK in August and September because of Irish quarantine restrictions which had "suppressed demand".
"Air travel between Ireland and the UK is being badly damaged by this ineffective 14-day quarantine," a spokesperson said. "This means 100,000 fewer visitors from the UK travelling to regional airports in Cork, Shannon, Knock and Kerry during the peak months of the tourism season."