Five years ago, during Spain's housing boom, Felix Jumbo worked as a builder. Now he digs pumpkins and cabbages in a district where construction cranes once swung.
Like millions in Spain, the 51-year-old Ecuadorian lost his job. But he keeps busy in one of thousands of "social allotments" that sprang up here during the crisis.
"For me and for a lot of people, this is a kind of therapy. It helps us forget about being unemployed," he said at the kitchen garden in the working class Adelfas neighbourhood of Madrid.
As a builder "I earned a lot of money, up to 3,000 euros ($3,300) a month," he said - but he has not found work since 2010.
So he and dozens of neighbours took over a patch of land near a railway, surrounded by housing blocks built during the construction bubble that burst in 2008.
They ran a long hosepipe from across the street, set up sprinklers, and began planting beans, lettuce, cabbages, tomatoes and pumpkins. Shoots started growing from the once-dry deserted ground.
"Little by little, we went from one vegetable patch to two, three, four. Now we have 16," Jumbo said.
Industrial revolution, organic age
Spain's construction bust threw millions out of work and into poverty - but it also left countless empty plots of ground where building sites were abandoned.
"What are they doing with those plots of land that were once intended for housing blocks? They are making urban gardens," said Gregorio Ballesteros, an expert from the Spanish Organic Agriculture Society.
There were about 2,500 such urban gardens across Spain in 2006 before the crisis. The number has now surged to more than 15,000 in 200 towns and cities, said Ballesteros.
"In Spain, many of the vegetable gardens are near railway lines, in places where the ownership of the land is not clear," he said.
This kind of kitchen garden became common in the United States and northern Europe in the late 19th century at the height of the Industrial Revolution.
They are "historically linked" to times of economic and social crisis and war, but nowadays are also a means of sustainable organic food production, Ballesteros said.
In Spain "we are a hundred years behind. We are still light years away from other countries".
Back from the dead
Some of the patches are publicly funded, such as ones in impoverished Andalusia, whose regional government helped set them up for poor families.
Barcelona is now formally authorising plots that had been taken over illegally, Ballesteros said.
READ: Eight cool things the crisis did for Spain
Elsewhere, plots have been set up by private initiatives such as Juan Tomate, a group running social allotments for the homeless.
At a shelter run by the Catholic order of San Juan de Dios in Madrid, Victoriano Castellanos stands in a straw hat among peppers, tomatoes and cucumbers.
"This is a way of being reborn," said Castellanos, 59, in a trembling voice. "You have come back from the dead."
The produce of this garden, set up a year ago, gets cooked in the kitchen of the homeless shelter.
Among the residents here are long-term homeless people as well as recent arrivals, including even lawyers and business people who have fallen on hard times, said the shelter's director Juan Antonio Diego.
Victor Noguera, 62, a sociologist by training, lived in various countries before winding up jobless back in Madrid. He arrived at the shelter four days ago and picked up a hoe.
"Feeling like a corpse as far as the job market is concerned is very hard to take," he said. "This helps you feel more psychologically balanced."
In Madrid's hip central Lavapiés district locals have set up a vegetable garden dubbed Esta Es Una Plaza -"This is a Square".
"Before we locals took it over, this was an abandoned plot, a sea of rubble and syringes," said Candela Martinez, 34, as local children ran around among the greenery.
For her it is a social meeting place as well as an allotment.
"Here, we grow relationships and feelings," she said.
By Anna Cuenca