(adds details, reaction from environmental groups)
By Andrés González
MADRID, June 24 (Reuters) - Spanish oil major Repsol could begin drilling for oil off the Canary Islands within months after the removal of the last legal hurdle to a $7-billion oil exploration project on Tuesday.
In 2012, Spain's government granted permits for exploration off the coasts of the islands of Fuerteventura and Lanzarote, but they were frozen while courts heard a number of appeals on environmental grounds.
Thousands of people marched in different cities and towns on the islands earlier this month to protest against the plans, which have been opposed by political parties, unions, environmental groups and other organizations.
"The seven appeals against the government's royal decree...have been rejected," a spokeswoman for the Supreme Court said on Tuesday. The court's written arguments will be published in the coming days, she said.
Spain produces almost no oil or natural gas and imports all of its hydrocarbon needs.
Environmental groups including Greenpeace, Oceana and the World Wildlife Fund - which have campaigned against the oil exploration plans - decried the ruling, saying a spill in the area would harm protected species, coral reefs, tourism and fisheries.
"The game is not over here. The decision of the Supreme Court affects the exploration drilling where they will detect whether there is commercially viable oil. Now we're going to mobilize at a European level against this," said Mario Rodriguez, director of Greenpeace Spain.
Of the seven appeals rejected by the Supreme Court, one was from the local Canary Island government, which initially supported the project but then turned against it.
It was not immediately possible to contact anyone at the Canary Island government.
Activists argue the exploration could hit tourism, the islands' main source of income. Greenpeace's Rodriguez said the potential damages were great compared with returns that he said would meet Spain's hydrocarbons needs only for two or three years.
Repsol, which leads a consortium including Australia's Woodside Petroleum Ltd and Germany's RWE Dea AG , has said exploration could start in the third quarter and commercial extraction could begin in 2019 if findings are positive.
Repsol will spend $350 million on the first two explorations and would invest $7 billion during the first five years to 2019 afterwards.
The production phase, expected to last 20 years, would require about $5.2 billion to extract crude oil.
Repsol said on Tuesday it would release a new strategic plan towards the end of the year, detailing its expected investments.
It estimates the Canary Islands project Sandia (Melon), which has a probability of geological success of 12 percent to 20 percent, could deliver 330 million barrels of recoverable resources and project Zanahoria, which has a 14 percent possibility of success, could deliver 107 million barrels. (Additional reporting by Fiona Ortiz; Writing by Sarah Morris; Editing by Elaine Hardcastle)