The emergency takeover of Credit Suisse by larger rival UBS was announced in March.

UBS and the Swiss government have agreed on how they will share losses linked to the bank’s emergency takeover of Credit Suisse, which will create a giant Swiss bank. The agreement clears the way for the takeover to close within days, .

The agreement announced Friday has been negotiated since the rescue of Credit Suisse (CS) in March. The Swiss government will guarantee up to 9 billion Swiss francs ($9.98 billion) of losses that UBS may incur from the sale of its rival’s assets beyond 5 billion francs, which the lender is due to cover itself.

The deal comes with various conditions, including the bank’s commitment to keeps its headquarters in Switzerland, the government said in a statement.

The Swiss government made the cash available to facilitate the emergency takeover of Credit Suisse and avoid a broader banking crisis that a collapse of the lender could provoke.

The loss protection agreement will become effective with the completion of the Credit Suisse takeover, expected as early as June 12, UBS said in a separate statement. It was one of the final hurdles UBS needed to clear before officially finalizing the biggest banking deal since the global financial crisis.

On Monday, UBS chief executive Sergio Ermotti hinted later that the bank was, in fact, on track to finalize the transaction.

“From Monday we will be new colleagues,” Ermotti told the Swiss Economic Forum in Interlaken, Switzerland.

The government money will not come for free, as UBS must pay various setup and maintenance fees plus premiums on any money drawn. The deal covers portfolio of Credit Suisse assets that were difficult to assess in the few days the banks had to hash out a deal and which are not needed as part of the future core business of UBS.

The government said the guarantee covered assets with a volume of around 44 billion francs ($48.7 billion), an equivalent of about 3% of the combined assets of the merged group. Valuations of the losses are expected to be made available during the third quarter of 2023, the government said, while their scale was “highly dependent on the actual winddown of the assets concerned and market developments.”

“Consequently, it is not yet possible to estimate the probability of the guarantee being drawn and the amount involved,” the government said.

Have it, not use it

The priority for the government and UBS was to “minimize potential losses and risks so that recourse to the federal guarantee is avoided to the greatest extent possible,” it said in the statement.

Ermotti has said UBS leadership would do everything possible to prevent Swiss taxpayers from bearing the costs of the takeover.

Vontobel analyst Andreas Venditti estimated that, based on the size of the portfolio covered by the guarantee, losses could come at the low end of his earlier 5-10 billion francs ($5.5-11 billion) forecast, suggesting UBS could cover them without taxpayers’ involvement.

The government pointed out that the agreement did not mention any federal participation in losses above the total agreed 14 billion francs ($15.5 billion) because that would require “a legal basis as well a parliamentary approval of a corresponding guarantee credit.”

A person familiar with the matter said UBS had been able to have a good look at Credit Suisse’s books and was confident the amount agreed was sufficient, with the bank’s level of confidence having increased since the takeover was announced.

Concerns that the combined bank — with a balance sheet of $1.6 trillion, roughly double the size of the Swiss economy — would be too big for Switzerland have led the country’s Social Democrats to propose radically shrinking UBS assets.

There have also been calls for UBS to keep Credit Suisse’s Swiss operation as a separate entity, to ensure competition and preserve the legacy of the 167-year-old lender.