Did UBS get the deal of the decade with Credit Suisse, or a decade of headaches? The investor debate is just getting started, but the answer to both questions might be yes.

UBS certainly got a good price. The $3.2 billion in stock it agreed to pay for Credit Suisse’s equity, less than half the company’s market value last Friday and just 7% of its tangible book value, is the headline number. Then there is the controversial write-off of Credit Suisse’s $17 billion in AT1 bonds. The lawsuits will come, but the decision was taken by the Swiss regulator rather than UBS, so the bank shouldn’t have to bear any costs.

Paying nothing for a fat tranche of Credit Suisse’s junior debt and almost nothing for its shares will leave UBS with a very large cushion of capital. Factoring in the deal, its Common Equity Tier 1 ratio of equity to risk-weighted assets would be above 18%, according to Morningstar analyst Johann Scholtz. That is far above peers and the company’s own target of about 13%.

It will need much of that capital to pay for the restructuring of Credit Suisse’s investment bank and its $160 billion of assets—long a source of worries for investors. For years, the failed company’s management didn’t move fast enough to shrink it, probably because they feared that the costs would force them to raise capital. They finally did tap the market for cash in October, but by then the damage to its brand was done and customers were leaving. Now the restructuring task will fall to UBS.

This is the obvious risk in the deal, but UBS might find the job easier than Credit Suisse, given the ample capital set aside to deal with it. Not only will UBS have a fortress balance sheet, but it also has an insurance policy against losses from the Swiss Treasury worth 9 billion Swiss francs, albeit with an excess of 5 billion francs that UBS would have to spend first. UBS has been here before: It shrank its own investment bank following a government bailout during the 2008 financial crisis.

SHARE YOUR THOUGHTS

What lies ahead for the UBS -Credit Suisse megadeal? Join the conversation below.

A less predictable problem might be damage to Credit Suisse’s wealth-management brand, and the reputation of Swiss banking generally. Credit Suisse lost 37% of its customer deposits and about 8% of its assets under management last quarter. Reports pointed to big outflows last week too. The takeover might stop the panic, but also start a measured reappraisal as wealthy clients diversify their portfolios, including away from UBS.

Also, the lesson of bank mergers forged in the 2008 financial crisis— Bank of America and Merrill Lynch, Lloyds and HBOS, among others—is that company cultures and IT systems take a long time to align. For years, UBS’s accounts will be littered with one-off costs and adjustments. This kind of messiness often leads to a valuation discount.

A further risk is political. UBS will be a banking behemoth in a small country that might not be able to support it in another crisis. Regulatory scrutiny will be even more intense and any sign of profiteering from the takeover, and the public support that sealed it, could lead to retribution. Investors already have a hint of this after UBS said Sunday it would pause buybacks.

Bankers are famous for drawing up deals that sound great on paper but are messy in practice. UBS will need to prove the cliché wrong.

Write to Stephen Wilmot at stephen.wilmot@wsj.com