Portugal’s move to bail out its second-largest bank gave investors renewed faith in the eurozone country’s banking sector … but shareholders and junior bondholders aren’t rejoicing.

The Bank of Portugal said Sunday it will rescue Banco Espírito Santo, S.A. by splitting the firm into a good bank and a bad bank. The general activities and assets of BES will be transferred into a new entity called Novo Banco, “which is duly capitalised and clean of problem assets,” according to the BoP.

Importantly, the bank’s 36.7 billion euro ($49.3 billion) in deposits and senior bondholders will be moved immediately into the new entity. That means clients will have uninterrupted access to their accounts and credit agreements will remain intact – stemming bank runs and asset liquidations that could have posed risk for the broader banking system.

Novo Banco, which will take on BES’s branding, at least temporarily, will be capitalized by a 4.9 billion euro ($6.6 billion) capital injection from Portugal’s Resolution Fund, which was crafted in 2012. The Resolution Fund actually operates using contributions from other banks, but since it’s not yet fully funded, it will have to take out a loan from Portugal’s Treasury that it will fully underwrite. As such, the PoB reckons the government itself “will bear no costs related to this operation.”

“The cost for the state takes the form of a temporary drain of the cash buffer for state support, which should not, however, significantly affect the state beyond potentially increasing 2014 [Portuguese Government Bonds] issuance by at most (4 billion euro),” Nomura economists Lefteris Farmakis and Dimitris Drakopoulos told the Japan-based investment bank’s clients Monday.

Shareholders and junior bondholders will face a tougher situation: They’ll remain in BES, with all of its toxic assets. The bad bank entity will be wound down, and both groups are expected to lose most if not all of the value of their holdings.

‘Extraordinary Events’

The rescue comes after BES revealed last month “extraordinary events” that resulted in impairment and contingency costs of 4.25 billion euro ($5.7 billion) for the first half of the year, knocking the firm to a net loss of 3.58 billion euro ($4.8 billion). Perhaps more worrisome, the bank that sports 80.2 billion euro ($107.7 billion) in assets, said its Tier I Common Equity Ratio – a key capital buffer – slumped to 5%, below the minimum regulatory requirement of 7%.

The losses were driven by a variety of factors including its exposure via credit agreements and guarantees to its largest shareholder Espírito Santo Group, deterioration in its loan book risk, and the recognition of losses on its participation in embattled Portugal Telecom, BES said in a regulatory filing. Essentially, a litany of soured loans and investments drove the bank to the brink of failure.

Regulators in the U.S. and Europe have been pushing for systems in which low-level stakeholders lose when a financial firm is bailed out to avoid a situation known as moral hazard, in which the an implicit guarantee that systemically-important financial institutions will be rescued when they’re on the brink of collapse gives them increased incentive to take risks. In a sense, the rescue of BES is an example of the system working since the country – which itself received a bailout – isn’t expected to face rescue costs.

The European Commission, which is the European Union’s executive body, approved the deal, saying “the adoption of this resolution measure is adequate to restore confidence in financial stability and to ensure the continuity of services and avoid potential adverse systemic effects.”

Mirroring those remarks, the Nomura economists said, “last night’s events are positive in the sense that they ring fence BES from the rest of the banking system in the interests of systemic financial stability.”

Investors Breathe a Sigh of Relief

Financial markets appeared reassured by the news. The PSI-20, an index that tracks the 20 biggest companies that trade on Euronext Lisbon, rallied 1.8% in mid-day trading, helping to soften a year-to-date loss of more than 11%. The STOXX Europe 600 Banks index – a broader gauge of the eurozone banking sector – jumped just about 1%.

Looking at credit markets, the yield on Portugal’s benchmark 10-year bond fell 0.08 percentage point to 3.62% after rising 0.12 percentage point Friday. Bond prices move in the opposite direction of bond yields, indicating traders are bidding up the asset. The cost to insure $10 million in Portuguese debt fell to $201,000 from $203,000 Friday, according to data from UK-based Markit.

The general feeling of calm in eurozone financial markets underscores the incredible comeback the 18-member currency bloc has undertaken since the debt crisis there nearly toppled the euro. The European Central Bank is taking action on several fronts to prop up the banking sector, and its chief Mario Draghi said he will do “whatever it takes” to save the union.

Follow Adam Samson on Twitter @adamsamson.