At least 19 people have waited more than a year to be released from hospital after being declared fit to leave
Some mental health patients are stuck in acute wards for years awaiting discharge.
Three Scottish health boards had patients wait for more than three years to be moved after being declared fit to leave.
Campaigners have said the issue needs to be addressed, with greater support needed for those who have spent time in hospital.
An investigation by the BBC on delayed discharges revealed that NHS Lothian, Tayside and Greater Glasgow & Clyde all had patients spend more than three years in hospital after they were said to be ready to be discharged.
At least 19 patients have waited more than a year to be discharged from health units in Scotland over the past two years. A further 32 had to wait more than 100 days.
Colin McKay, chief executive of the Mental Welfare Commission for Scotland, said the delays were a "human rights issue".
He said: "These are people who are in hospital when they don't need to be and sometimes don't want to be. They may have been detained in the hospital under the mental health act and are being required to stay there for substantially longer periods than they need to be for their clinical needs. That just isn't acceptable, and it needs to be addressed."
Billy Watson, chief executive of the Scottish Association for Mental Health (SAMH), said more investment had to be made in community mental health services.
He said: "Keeping people with mental health problems in hospital longer than is necessary isn't good for their mental health or their long-term recovery. We want to see people being treated on an individual basis and settling back into their community as soon as they are ready to do so.”
NHS Lothian apologised to all patients who had suffered a delay in discharge, whilst NHS Tayside said the issue was being treated as a top priority.
A spokesman for NHS Greater Glasgow and Clyde said "significant improvements" had been made on delayed discharges in recent years.
Health Secretary Shona Robison said: “These cases are exceptional circumstances – mental health patients can present extremely complex needs where mainstream care provision is simply unsuitable.”