The Spanish government is set to launch a sweeping restructuring of its
troubled regional savings banks in an attempt to reassure the market it can
sort out the problems of its financial system.

Forty out of a total of 45 Spanish cajas will merge or form operating alliances with each other as the authorities look to prevent fears over the banking system from morphing into a wider market run on the country as a whole.

Alfredo Perez Rubalcaba, Spain's deputy prime minister, said: "The government is preparing a plan, the aim of which is to increase the solvency and the credibility of the savings banks."

It is hoped that private investors can be found to put money into the cajas. However, Spain's Fund for Orderly Bank Restructuring could take stakes in those that are unable to attract outside investment.

Spain's main IBEX index of leading shares closed up nearly 2pc on the back of the news, which helped calm fears of a banking crisis brewing in the country.

Shares in Spain's two largest banks, Banco Santander and BBVA, led the rebound, each rising more than 3pc.

While all of Spain's major banks passed last year's European Union-organised bank stress tests, five out of the 19 cajas included in the test failed it.

Speaking before the announcement of the restructuring plan, analysts at ratings agency Fitch said the country would need a "credible" plan to ensure it maintained its sovereign credit rating at its current level.

David Riley, global head of sovereign ratings at Fitch, said he expected the cost of the recapitalisation of the cajas to come in at about €50bn (£42bn) to €60bn.

"If we get much larger recap costs than we have currently built into our rating, then obviously that would prompt us to have a look at the rating again," Mr Riley said.

Moody's, a rival credit rating agency, last month put out a negative outlook on Spain, citing its worries about the outlook for the banking system, which has struggled with losses largely related to loans to property developers.