Official statistics today reveal there were 581 drug-related deaths in Scotland last year - the second highest number ever recorded.

The 2012 total was up 199, or 52%, on the figure recorded a decade previously in 2002.

Methadone was implicated in, or potentially contributed to, 41% of last year's drugs-related deaths, compared to 38% for heroin and/or morphine.

Deaths where so called "legal highs" were implicated have also been recorded. Last year, there were 47 deaths where they were involved. In five of those cases, they were the only drug present.

The official statistics, published by the General Register Office for Scotland, provide an in-depth analysis of drug-related deaths in Scotland in 2012.

Among the report's main findings was the conclusion that the 581 drug-related deaths registered last year was down three, or 0.5%, on 2011's high of 584.

There were 199 drug-related deaths of people aged 35-44, 34% of last year's overall total. In the 25-34 age bracket, there were 171 drug-related deaths, or 29%.

Men accounted for almost three in four drug-related deaths, or 72%.

Of the total number of drug deaths last year, heroin and/or morphine potentially contributed to 221 fatalities, while

methadone was implicated in or may have contributed to 237 deaths.

While this was down by 38 on the 2011 figure, it still represented a "large increase" compared with 2008 to 2010, statisticians said. In 68 deaths, methadone was the only drug implicated, alongside alcohol in some cases.

Cocaine, ecstasy and amphetamines may have been linked to 31, 9 and 18 deaths respectively while alcohol was implicated in 111 of the drug-related deaths.

"Legal highs" were involved in 47 deaths and they were implicated in, or potentially contributed to, 32 of those deaths, statistics showed.

On the overall picture, the report stated: "The past 10 years have had five rises and five falls in the number of drug-related deaths.

"However, the rises have tended to be greater than the falls, so the trend in the number of drug-related deaths has been upwards."

Regional breakdowns of the drugs statistics show the Greater Glasgow and Clyde NHS board area saw the most drug-related deaths last year, at 193.

The Lothians had 90 deaths while Lanarkshire accounted for 61 and Tayside had 55 deaths.

The annual average for Scotland from 2008 to 2012 stands at 554 drug-related deaths per year - a rate of 0.11 per 1,000 people, or a death rate of 9.3 per 1,000 problem drug users.

Comparing the annual average for 2008-2012 with that for 1998-2002 revealed that the largest increase was for 35-44 year olds, the largest percentage increase was for people aged 45-54, and there was a fall in the number of drug-related deaths of people aged under 25.

The Scottish Government welcomed the 20% drop in the number of young people dying of drug misuse, down from 58 in 2011 to 46 last year in the under-25 age bracket.

Community safety minister Roseanna Cunningham said: "The Scottish Government is dealing with a legacy of drug misuse which stretches back decades and, as in previous years, the statistics published today show that many of these deaths are older drug users who have become increasingly unwell throughout the years.

"It is encouraging that drug deaths statistics show fewer young people are dying.

"This is in keeping with wider statistics on drug use in Scotland that show a decrease amongst the general population, and that use by young people is at its lowest for a decade.

"There has also been a substantial drop in the number of deaths where methadone alone is implicated, a fall of 39% from 112 in 2011 to 68 in 2012."

On methadone use, she added: "Last week, the independent expert group published their report into Opiate Replacement Therapy which said that they should continue to be used to treat heroin addiction in Scotland.

"We are currently considering the report in detail and will respond in the coming months."

Dr Roy Robertson, of the National Forum on Drug-related Deaths, said: "It is always disappointing to see the depressing loss of life from drug-related causes.

"The national forum on drug-related deaths provides independent advice to the Scottish Government to ensure that the ambition of the Road to Recovery strategy is fully implemented in Scotland and we endorse the approach taken in the strategy.

"These statistics will help us to review what more can be done by a range of partners and agencies across the country to reduce the risk of drug deaths and help drive the strategy forward."

Meanwhile, separate official statistics show that the number of alcohol-related deaths fell by 167, or 13%, to 1,080 in 2012, the lowest annual total since 1997.

There were 420 alcohol-related deaths of people aged 45-59, 394 deaths of 60-74 year olds and 145 deaths of people who were 30-44. In the under-30 age group, there were 14 such deaths in 2012.