UBS Group AG has agreed to buy Credit Suisse Group AG in a historic, government-brokered deal aimed at containing a crisis of confidence that had started to spread across global financial markets. 

The Swiss bank is paying 3 billion francs ($3.2 billion) for its rival in an all-share deal that includes extensive government guarantees and liquidity provisions. The price per share marked a 99% decline from Credit Suisse’s peak in 2007.

The Swiss National Bank is offering a 100 billion-franc liquidity assistance to UBS while the government is granting a 9 billion-franc guarantee for potential losses from assets UBS is taking over. Regulator Finma said about 16 billion francs of Credit Suisse bonds, known as AT1s, will become worthless to ensure private investors help shoulder the costs.

UBS slumped 8.8% in early Zurich trading, while Credit Suisse declined about 64%, valuing the firm at about 2.71 billion francs.

The plan, negotiated in hastily arranged crisis talks over the weekend, seeks to address client outflows and a massive rout in Credit Suisse’s stock and bonds over the past week following the collapse of smaller US lenders. A liquidity backstop by the Swiss central bank mid-week failed to end a market drama that threatened to send counterparties fleeing, with potential ramifications for the broader industry.

“It was indispensable that we acted quickly and find a solution as quickly as possible“ given that Credit Suisse is a systemically important bank, Swiss National Bank President Thomas Jordan said at a press conference late Sunday.

The Federal Reserve and Treasury Department welcomed the deal, as did the European Central Bank. US authorities had been working with their Swiss counterparts because both lenders have extensive operations in the US, Bloomberg reported earlier. Authorities sought an agreement before markets opened again in Asia. The transaction is expected to be completed by the end of the year if possible, Credit Suisse said in a statement Sunday.

The Fed and five other central banks announced coordinated action on Sunday to boost liquidity in US dollar swap arrangements, the latest effort by policymakers to ease growing strains in the global financial system.

UBS Chairman Colm Kelleher said he will shrink Credit Suisse’s investment bank, a unit that has racked up losses in recent years, likely ending the dreams of a CS First Boston spinoff. The Swiss universal bank, the one business of Credit Suisse that has remained a relative bastion of stability, is expected to stay with UBS, despite concerns about concentration in the domestic market.

“Let me be very specific on this: UBS intends to downsize Credit Suisse’s investment banking business and align it with our conservative risk culture,” he said at a press conference announcing the deal. He said it’s too early to say how many jobs may be cut after the deal.

The government’s loss-guarantee was necessary because there was little time to do due diligence and Credit Suisse has hard-to-value assets on its books that UBS plans to wind down, Kelleher said. If that results in losses, UBS would assume the first 5 billion francs and the federal government the next 9 billion francs.

Kelleher said it’s too soon to know a job-cut number, but UBS indicated it will be significant. The firm said in a statement Sunday it plans to cut the combined company’s annual cost base by more than $8 billion by 2027. That’s almost half of Credit Suisse’s expenses last year.

Credit Suisse told staff in an internal memo it will work to identify which roles might be impacted, and “will aim to continue to provide severance in line with market practice.” There will be no changes to payroll arrangements and bonuses will still be paid on March 24, the memo said. A spokeswoman confirmed the contents of the memo.

Under the deal, Kelleher and UBS Chief Executive Officer Ralph Hamers will retain their roles in the combined entity. A representative for Finma, said at the press conference that Credit Suisse’s management will stay in place until the deal closes. Then, their future becomes a decision for UBS.

Hamers told staff not to talk about business matters with counterparts at Credit Suisse.

“Please remember that, until this deal closes, Credit Suisse is still our competitor,” Hamers wrote in a memo to employees. A spokesperson for UBS didn’t immediately respond to an email seeking comment on the memo.

The takeover of the 166 year-old lender marks a historic event for the nation and global finance. The former Schweizerische Kreditanstalt was founded by industrialist Alfred Escher in 1856 to finance the build-out of the mountainous nation’s railway network. It had grown into global powerhouse symbolizing Switzerland’s role as a global financial center, before struggling to adapt to a changed banking landscape after the financial crisis.

UBS traces its roots back through some 370 separate institutions, culminating in the merger of the Union Bank of Switzerland and the Swiss Bank Corporation in 1998. After emerging from a state bailout during the 2008 financial crisis, UBS built a reputation as one of the world’s largest wealth managers, catering to high- and ultra-high net worth individuals globally.

While Credit Suisse avoided a bailout during the financial crisis, it has been hammered over recent years by a series of blowups, scandals, leadership changes and legal issues. Clients had pulled more than $100 billion of assets in the last three months of last year as concerns mounted about its financial health, and the outflows continued even after it tapped shareholders in a 4 billion-franc capital raise.

“This was the only possible solution,” Swiss Finance Minister Karin Keller-Sutter said, adding it was needed to stabilize the Swiss as well as international financial markets. Credit Suisse, she said, was no longer able to survive on its own.