Spain's banks lent heavily to real estate developers during a decade-long property boom which ended in 2008, leaving creditors with bad loans to housebuilders, unfinished apartment complexes and brownfield sites.

The euro zone's fourth largest economy is unable to raise funds on the international markets to cover these losses at reasonable prices and had to ask on Saturday for up to 100 billion euros ($125 billion) from the euro zone to shore up its financial system.

The International Monetary Fund said in a report on Friday that the most troubled former savings banks, accounting for around 22 percent of the country's financial system, faced the biggest challenge due to their high real estate exposure.

The IMF did not name the entities, but seven savings banks have received state help to cope with losses and absorb mergers. Spain now has around 10 savings banks, less than a quarter of their number two years ago after the government forced a program of consolidation.

The seven banks are Catalunya Caixa; Unnim - now part of BBVA; Espana-Duero - merged with Unicaja; NovaCaixaGalicia; Bankia; Banco Mare Nostrum; and Banca Civica - which belongs to CaixaBank.

Of those, the most problematic are fourth-biggest lender Bankia, nationalized in a 23.5 billion euro ($29.3 billion)rescue last month, and the two former savings banks struggling with capital shortfalls - mid-sized NovaCaixaGalicia and CatalunyaCaixa.

Both these banks were created by combining savings banks in autonomous regions - Galicia and Catalonia - partly to placate local politicians. The state took them over last year when it became clear they could not handle their losses.

These two lenders require around 9 billion euros to cover the latest government demands for capital to cushion against real estate loan defaults, the Bank of Spain told a closed-door parliamentary committee hearing, according to a political source present at the briefing.

Small listed lender Banco de Valencia is another potential black spot. It was also taken over by the government with an intent to auction it off with guarantees against future losses.

The lender is based in the region of Valencia, home to savings bank CAM which was called the 'worst of the worst' by a former central bank governor after losses began to soar when exposure to real estate at the bank was properly recognized.

Along with its fellow Valencian lenders - CAM and Bancaja, which ended up as part of Bankia - Banco de Valencia lent unsustainably to property developers who threw up block after block of holiday apartments along Spain's Mediterranean coast.

GRANDIOSE PROJECTS

The savings banks or cajas were originally set up to provide loans to people suffering in the aftermath of the Peninsular War with Napoleonic France in the early nineteenth century. Often founded by the Roman Catholic Church, they aimed to give farmers loans at reasonable interest rates during times of poor harvest.

However, having a savings bank in fiercely regional Spain became a sign of autonomy. Many got hijacked by local governments who put politicians on their boards and hived off funds to pay for grandiose construction projects.

Nowhere was this more evident than in the eastern region of Valencia, where the cajas bankrolled huge loss-making projects aimed at increasing the status of the region such as art centers, film studios and airports.

Reports that former directors at NovaCaixaGalicia and Alicante-based CAM had awarded themselves handsome severance pay packages after they were taken over by the state provoked public outrage last year.

Now Spain could even be considering folding all its rescued banks into one nationalized bank if planned auctions were not successful, a senior Economy Ministry source has said.

Some mergers and sales are still happening. Former savings banks Ibercaja and Caja 3 are beginning a three-way merger with Liberbank. Together they hold toxic real estate assets of around 11.8 billion euros, around a quarter of the amount held by Bankia and parent company BFA.

BEYOND REAL ESTATE WOES

There are also concerns about the mid-sized and small listed lenders, with the IMF saying these entities could record losses in 2012 due to increased provisioning requirements against performing real estate loans.

Citi forecasts 2012 losses for Popular, CaixaBank and Banesto as a result of the extra provisioning.

Popular has high exposure to real estate loans. It said on Wednesday it would set aside more capital to cover potential losses beyond real estate, on mortgages and loans to businesses - something other banks may have to contend with too after an independent audit of the sector is completed this summer.

A recession in Spain threatens to deepen the problems for the troubled lenders.

"Unless the government maintains its current spending, incomes in Spain will fall and the sustainability of the private sector debts will be undermined," said analysts at CreditSights, pointing out that at the same time Spain was trying to cut its big budget deficit.

Standard & Poor's downgraded mid-sized bank Sabadell, buyer of CAM, to junk status in April. ($1 = 0.8021 euros)

(Reporting by Sonya Dowsett; editing by David Stamp)

By Sonya Dowsett

Stocks treated in this article : Banco de Valencia SA, CaixaBank SA