With roughly 300 days of sunshine per year and regions that receive strong winds, Spain was a world leader in 2007-08 in solar and wind power production, helped by generous state subsidies.
But the sharp economic downturn that followed the collapse of a decade-long property bubble in 2008 put the brakes on the development of renewable energy as the government scaled back support.
Jorge Puebla, a 41-year-old firefighter, suffered the fallout from his energy investment.
"They ruined my life," the father of two told AFP.
He and his wife had invested a million euros ($1.1 million dollars) in 2007 in a solar energy farm in the northeastern region of Castile and Leon.
They borrowed 800,000 euros from a bank with Puebla's parents acting as the loan guarantors.
Solar investors like Puebla were lured by a law passed under the Socialist government in power in 2007. It guaranteed producers a so-called solar tariff of as much as 44 cents per kilowatt-hour for their electricity for 25 years.
At that rate the couple thought they could easily make their monthly loan repayments of 8,400 euros.
But the government did not keep its promise. Faced with a ballooning budget deficit, in 2011 it cut the subsidies that were intended to stimulate the growth of the renewable energy.
The conservative Popular Party that swept to power at the end of 2011 made further cuts to the state aid.
"Everything that existed disappeared from one day to the other," said Puebla.
He now relies on help from his sister and three brothers to pay his loan.
- Low energy -
Solar power farms have seen their revenues drop 15-50 percent due to the change in government policy, said Jose Donoso, the head of Spain's solar lobby group UNEF.
The solar power sector has shed 35,000 jobs since 2008 and now employs just 5,000 people, he added.
The government U-turn has been especially hard on the roughly 62,000 private investors like Puebla and it essentially stopped the solar power sector from expanding.
Spain added just 22 megawatts of photovoltaics capacity last year, compared with 2,270 megawatts in Britain.
Wind power has also stalled. The sector has lost half of its jobs in eight years and no new wind power capacity was added in 2015.
"The change in regulations since 2008 was negative for the entire industry," said Carlos Garcia, a renewable energy specialist at the IE Business School in Madrid.
He points the finger at "pressure" from traditional energy producers that rely on coal, gas, oil and nuclear power to "stop the development of renewables".
It is not just small and medium-sized businesses that are suffering.
Spain's flagship renewable energy giant Abengoa which employs more than 27,000 people worldwide is teetering on the edge of bankruptcy. While the loss of subsidies is not the main cause of its troubles, experts say it has not helped.
- 'Make up lost time' -
"2015 marks the lowest point in the development of renewables in the past 20 years in Spain," said Spanish Wind Energy Association policy director Heikki Willstedt.
"Spain must make up for lost time and fulfil its goals for 2020," she added.
Willstedt recalled that Spain is committed to meeting 20 percent of its energy needs through renewables by 2020, compared to the current 15 percent.
The government which emerges following the general election on December 20 must change Spain's renewable energy policies, added Garcia.
Spain's ruling conservative Popular Party has presented proposals to restart the wind power sector but has not yet outlined its plans for solar energy.
Prime Minister Mariano Rajoy vowed at the World Climate Change Conference 2015 (COP21) in Paris on November 30 to table a "law on climate change" if he is re-elected, after having complained for a long time that renewable energy is too expensive.
Spain has maintained companies "with significant know how" in the area such as Gamesa which survived the economic downturn by expanding abroad, mainly in Latin America, said Garcia.
The country is still the fifth largest producer in the world of wind power and the third biggest exporter.