Scotland's 1980s "Trainspotting generation" has driven drug-related hospital admissions to a record high while illnesses linked to long-term alcohol abuse are also on the rise, official figures show.

Hospital stays linked to opioids, of which the main street drug is heroin, have risen fivefold from 791 in 1996/97 to 4,511 in 2014/15, figures from NHS Scotland's Information Services Division (ISD Scotland) show.

Drug-related hospitalisations have remained steady amongst under-25s, but have been rising for all age groups beyond that, with the largest increases seen in over-40s.

There has been an elevenfold increase in admissions of those aged 40-44, from 20 per 100,000 to 236.

There was an even bigger fifteenfold increase amongst 45 to 49-year-olds from 11 per 100,000 to 166, while admissions of those aged 50-54 have increased by a factor of 12 from seven per 100,000 to 84.

There were almost as many hospital stays linked to opioid use as there were for alcohol dependence (4,747) in 2014/15.

Meanwhile, alcohol-related psychoses have almost overtaken liver disease as the most common cause of chronic hospital admissions linked to long-term alcohol abuse.

The rate of admissions for psychoses, such as hallucinations or delusions, has been rising steadily from around 50 admissions per 100,000 people in 1997/98 to around 120 in 2014/15, almost the same as alcoholic liver disease.

There were 6,479 hospital stays for alcoholic psychoses in 2014/15, compared with 6,963 stays for alcoholic liver disease and 4,747 stays for alcohol dependence, figures from ISD Scotland show.

General harmful use of alcohol remains the most common cause of acute hospital admissions, at 10,461 stays in 2014/15, equating to a rate of 202.1 stays per 100,000.

While psychoses have been rising steadily, harmful use had been on the wane from a peak of around 280 admissions per 100,000 in 2007/08 to fewer than 200 cases in 2012/13, but there has been a slight increase since then.

Alcoholic liver disease is also on the rise again following a slight drop.

There has also been a 5% rise in the number of people in Scotland treated with antidepressants to 814,181 in 2014/15, up from 778,180 in 2013/14.

David Liddell, director of the Scottish Drugs Forum, said: "The figures reinforce the trend over many years showing an increase in people with a drug problem in the older generation.

"Of the 613 drug-related deaths in the most recent figures, around 400 of them were over 35.

"Part of the problem will be 40-year-olds who have used drugs for 20 years or more and have the health of people in the general population in their 60s.

"I hesitate to use the phrase 'Trainspotting generation', but that is a phrase we have used to describe those who started using in the 1980s or early '90s.

"There was obviously a big explosion in heroin use in the early 80s, which spread from major urban centres to more rural areas, which is contributing to the age profiles that we are seeing today."

Public Health Minister Maureen Watt said: "The latest figures for alcohol-related hospital stays show a decrease from last year and this continues decreases since 2007-08.

"However, the latest rate is still more than four times higher than in the early 1980s, so there is still more work to be done.

"Recent statistics show that alcohol-related deaths have increased by 5% in the last year, following a 2% rise the previous year.

"Alcohol misuse is not a marginal problem or restricted to one particular sector of society.

"Excessive daily and weekly consumption is common across different age and socio-economic groups."

The Scottish Government is working on the next phase of its alcohol strategy to tackle the 670 hospital admissions and 22 deaths a week linked to alcohol, she said.

Scottish Conservative health spokesman Jackson Carlaw said: "These are very worrying figures which show just how big a problem addiction to drugs and alcohol remains in Scotland and the consequences for our NHS from the pressure at A&E to the chronic illnesses which can follow with longer-term hospital treatment.

"It's clear Scotland's NHS and everyone in it is doing all they can.

"However, if we are to avoid an ever-deteriorating position and the consequences of this for individuals and healthcare more generally, then we have to make real progress in changing attitudes and far more fundamentally than we have managed to date."

Scottish Liberal Democrat health spokesman Jim Hume MSP said: "These figures reveal that Scotland's drink and drugs habits are putting our NHS under enormous strain. We know that this has been a real problem for years, but we are still seeing increases in admissions relating to alcohol and drug misuse.

"These problems affect people of all ages and all backgrounds, especially those living in the most deprived areas in Scotland. We need a comprehensive strategy to tackle alcohol and drug misuse. It is time that the SNP got a grip."

A Scottish Government spokeswoman said: "The number of adults reporting drug use fell by 1.4% between 2008/09 and 2012/13 and is continuing to fall while drug taking among young people is at its lowest level in a decade.

"The statistics published today confirm what we already know - there is a vulnerable group of older drug users who experience chronic medical conditions as a result of long-term drug use.

"For many years Scotland has faced the difficult task of rehabilitating this generation of individuals which is why earlier this year the Scottish Drugs Forum set up a group that specifically works with older drug users. With Scottish Government support and funding the group will identify and understand the current needs of this vulnerable cohort of drug users and will seek to predict their future medical and support needs, helping to reduce any additional demands on our health services."

She added: "Scotland is the first country in the world to introduce a national naloxone programme to reverse the effects of an opiate overdose. Through this Scottish Government funded programme over 22,000 kits have been issued to date.

"The national research framework, published last week, highlights key research priorities into the challenges around problem drug use and recovery in Scotland. It has been developed in partnership with leading academics in the drugs field, national partners, NHS Health Scotland and ISD Scotland. Through greater collaboration, this framework will help strengthen research into problem drug use and recovery."