* Spain homelessness up 24% since 2012

* Social housing stock way below EU average

* Tourism boom also fuelling short-term rentals

* Spain needs to add 1.5 mln homes to meet target, cenbank says

MADRID, July 11 (Reuters) - Francisco Carrillo sobbed with relief as he lay on the bed in his new apartment in Madrid provided by a charity after three years of sleeping rough in the backroom of a theatre.

The 62-year-old pensioner found he couldn't afford rental prices in the capital when he moved from Jaen in southern Spain to seek treatment for throat cancer.

"Tonight, I'm going to sleep like a baby," he said.

Carrillo is one of a growing number of Spaniards who have found themselves priced out of the market amid a shortage of social housing and regulations that deter long-term rentals.

The situation has been exacerbated by a boom in holiday lets on platforms such as Airbnb and Booking.com, which has spurred a wave of protests across the country in recent weeks.

The rate of homelessness has risen by 24% since 2012 to 28,000 people, according to official statistics while, according to a Bank of Spain report, about 45% of people living in rented accommodation are at risk of poverty or social exclusion, the highest proportion in Europe.

Homelessness has increased substantially across Europe over the last decade, the European Commission said, but the extent of the problem in Spain is masked by young Spaniards opting to live with their parents for longer.

More than 60% of 18-34-year-olds live in the family home and Spain had the fastest rising rate of young people living with their parents among major European economies between 2008 and 2022. Spain's social housing stock is just 1.5% of all homes compared to a European average of 9%, the report added.

Competition for apartments to rent privately is fierce. About 40 people answer each listing that comes on the market in Madrid, according to property listings website Idealista.

The Socialist government's current plan for public housing will add 184,000 units over the next three years. Prime Minister Pedro Sanchez said in May he would like the social housing stock to match the European average during his term ending in 2027.

But the Bank of Spain estimates that an additional 1.5 million more homes are needed to meet that target.

The 90,000 units-per-year pace of homebuilding is trailing growth in demand and far below the 650,000 homes built in 2008, according to official data.

Housing Minister Isabel Rodriguez said on Tuesday that the government had begun to work on a new plan to meet that target.

FILLING THE VOID

To fill part of the void left by the state, charities are turning to private capital - even if it's a fraction of what's required.

The flat provided to Carrillo by Mundo Justo (Fair World) belongs to Techo, a social investment fund that provides rental homes to charity groups working with the homeless, and which in April floated on the Spanish stock market with the support of 33 business partners, including global firms EY and CBRE.

Techo owns around 230 flats and works with 50 NGOs who charge rent at 30% below market rates. For investors it's an opportunity to secure a return while also boosting their environment, social and governance (ESG) scores, said Blanca Hernandez, chair of the real estate investment trust.

Another charity, Hogar Si, rents 400 apartments to the homeless. Two years ago it began to seek investors to buy some of those flats as a way to reduce costs.

José Manuel Caballol, head of the Hogar Si foundation, said the housing crisis requires a mix of private and public initiatives on social rent.

"We need to be much more ambitious," he said.

Big cities such as Madrid are also having to cope with migration from the countryside to urban centres where the jobs are, said Diego Lozano, CEO of the city's housing agency.

As many as 48,000 people are on a waiting list for social housing in Madrid. Lozano said the city is working to almost triple its social housing stock to 15,000 by 2030, but admitted that still won't meet demand.

He also blamed a recent law designed to protect tenants' rights by allowing vulnerable people to remain in a property for up to two years without paying rent, which he said had a cooling effect on owners weighing long-term rentals.

Landlords are demanding rent payment guarantees from tenants that the poorest can't provide, according to three NGOs consulted by Reuters.

Others are switching to the lucrative short-term market that isn't governed by the same regulations. The supply of long-term rentals has fallen 15% in a year, while short-term rentals mainly for tourists increased by 56% in the year to March, according to Idealista.

Pensioner Carmen Cajamarca, 67, received a letter giving her one month to leave her rented flat in the Madrid neighbourhood of Lavapies after the building where she has lived for 25 years was sold to an Argentine fund that is refurbishing its apartments for holiday lets.

Cajamarca said she will leave Madrid, and is delaying as long as possible as she searches for a new home.

"This is only for tourists ... and the people who have always lived here, where are we going to live?" she said.

The crisis is so acute that Spanish cities are trying to limit or phase out holiday apartments.

In Cadiz, Eva Orihuela joined a local movement to ban holiday lets after her 88-year-old mother Maria faced imminent eviction before the local soccer club stepped in to buy her home to let to her at the same rent.

Orihuela was relieved that her mother would continue to have a roof over her head.

"But there are many more Marias," she warned. (Reporting by Corina Pons; with additional reporting of Belen Carreno; editing by Charlie Devereux, Aislinn Laing and Sharon Singleton)