Air New Zealand agreed a two-year loan deal with the government to protect essential routes and ensure the national airline keeps operating as the coronavirus outbreak virtually halts international travel.

The NZ$900 million ($510 million) debt facility is able to be drawn down if cash reserves drop below minimum thresholds, the Auckland-based airline said Friday. It has canceled its first-half dividend as a condition of the agreement and undertaken not to pay future dividends while the facility is in use.

Air New Zealand has cut long-haul capacity by 85% and signaled a 30% reduction in staffing as border restrictions and a global reluctance to travel have slashed demand. The government, which owns 52% of the airline, said this week it was in talks on a form of financial assistance.

“Without this intervention, New Zealand was at risk of not having a national airline,” Finance Minister Grant Robertson said in a statement. “The government owns 52% of the company, which means we have a responsibility toward it. We have acted swiftly to put this loan agreement in place and support our national carrier.”

The stock plunged 45% in Wellington after a trading halt in place since early Monday was lifted today. It fell to 85 NZ cents at 11:15 a.m. local time, the weakest since mid-2012.

The agreement means Air New Zealand can continue to provide essential flights and freight lines for goods like pharmaceuticals, and get New Zealanders home from overseas, Robertson said.

The agreement also safeguards the domestic network, with flights assured to all current destinations, he said.

The debt facility is in two tranches—NZ$600 million with an effective interest rate of 7-8%, and NZ$300 million with an interest rate “expected to be in the order of 9%,” the airline said. The facility is available for 24 months, with interest rates rising after the first year.

In addition to the dividend conditions, the government has the ability to seek repayment of the loan through a capital raise by the airline or by converting it to equity, the airline said.