Image caption The proportion of power in Scotland generated from renewable sources was significantly higher than the rest of the UK

A record two fifths of electricity used in Scotland came from renewables last year, official figures have revealed.

UK government figures showed 40.3% of energy consumption in 2012 was met by the sector - up from 36.3% the previous year and 24.1% in 2010.

Energy minister Fergus Ewing said the figures showed renewables were "going from strength to strength".

Environmental campaigners welcomed the figures but said more needed to be done to meet targets.

Our support for renewable generation will help protect Scotland's consumers by keeping energy prices down in the long term Fergus Ewing, Energy minister

The Scottish government said it was on course for half of electricity use to come from renewable sources by 2015, an interim target ahead of the goal of having the sector generate 100% of the country's electricity by 2020.

Scotland continues to produce more energy than it uses, with more than 26% of electricity generated here last year being exported, figures from the Department of Energy and Climate Change showed.

Nuclear power provided 34.4% of electricity generated in Scotland in 2012, while 29.8% came from renewables, 24.9% came from coal, 8% from gas and 2.8% from oil and other sources.

The proportion of power in Scotland generated from renewable sources was significantly higher than the rest of the UK.

While 29.8% of electricity generated in Scotland was from renewables, in England the sector produced only 8.2% of electricity, while in Wales and Northern Ireland renewables accounted for 8.7% and 15.9% respectively.

'Protecting consumers'

Mr Ewing said: "Renewable electricity in Scotland is going from strength to strength, confirming that 2012 was a record year for generation in Scotland and that 2013 looks set to be even better.

Scotland will need to deploy significant amounts of offshore wind in the near future Lang Banks, WWF Scotland

"These figures show that renewable generation was meeting around 40% of our electricity demand and helping keep the lights on across these islands at a time when Ofgem [the energy watchdog] are warning of the ever tightening gap between peak electricity demand and electricity supply."

He added: "Our support for renewable generation, combined with energy efficiency measures, will help protect Scotland's consumers by keeping energy prices down in the long term."

Environmental campaigners at WWF Scotland welcomed the figures, but said to meet the Scottish targets "significant amounts" of offshore wind power would be needed.

Offshore wind

Director Lang Banks said: "Most importantly, Scotland is further along the track to meeting its 2020 target than we thought, which means ever greater amounts of climate change emissions are being avoided every day.

"However, in order to remain on target Scotland will need to deploy significant amounts of offshore wind in the near future.

"It's therefore vital that the UK government gives a stronger signal of its ambition on the growth of offshore wind in Scotland's seas, as well as the necessary support needed to deliver that growth.

"We also need to see a quick resolution to outstanding issues over transmission charges and the harnessing of renewable energy from Scotland's islands."