The governor of one of Scotland's highest security jails has called for secure care facilities outside the current prison system, to hold inmates with age-related conditions and disabilities.

Nigel Ironside, governor of HMP Glenochil, said the prison system was struggling to cope with prisoners who have significant health problems, or needed palliative care for terminal illnesses.

While the average prisoner is aged 28 or 29, Scotland's prisons house more than 300 prisoners aged 50-54, around 150 aged 55-59, just short of 100 aged 60-64 and another 85 to 90 aged over 65, according to recent figures.

However, the numbers are predicted to rise, with more than 800 prisoners expected to be aged over 50 by 2018 and nearly 1000 by 2023.

An increase in elderly and infirm people being sent to jail has been exacerbated by a trend towards longer sentences, and a surge in convictions of people for historic sex crimes, on the back of high profile investigations such as the Operation Yew Tree investigation into the crimes of Jimmy Savile and other celebrity figures including Max Clifford and Rolf Harris.

The problem is particularly acute at Glenochil, which houses around half of Scotland's jailed sex offenders. One in five inmates at the prison (around 120) is aged over 50, of whom 15 require the equivalent of 'home care' services such as help getting out of bed in the morning, assistance with toileting or continence and help eating or dressing, while 70 would need help evacuating if there was an emergency such as a fire.

Mr Ironside said the prison service should work with the NHS and councils to develop alternatives to standard jails for such prisoners, and described his idea as "a shared collaborative facility that allows secure care in an environment that is care-orientated, but also has a fairly strong security element to it."

Mr Ironside added: "What is very obvious is that managing them in our current prison estate, which is designed really for maximising spaces, is not appropriate and we can't adjust to fix it.

"So something different, a new design, in an appropriate location is really what we are talking about."

The Scottish Prison Service (SPS) has removed hospital wings in prisons over recent years, with the NHS providing health care inside prisons or in hospitals where necessary. However people with terminal or serious illnesses might need to be moved to a new kind of secure care location in future, Mr Ironside said in an interview with Holyrood Magazine.

"We're not just talking about old men," he added. "There are young offenders who have terminal illness and there are also female offenders who have terminal illness, so how do you manage that mix appropriately in an area that provides secure but dignified care?

"For some terminal cases they might be terminal for quite a long period of time and it might be that it's appropriate to keep them in this environment before they would go to another environment when their health starts to deteriorate."

The SPS has already commissioned a high healthcare needs strategy group to look at predictions about the changing prison population and how acute and chronic healthcare needs of prisoners can be met.

However the prison service distanced itself from Mr Ironside's views, saying the issue was a significant problem for the system, but the Glenochil governor's views were personal, not SPS policy.

A spokesman said: "The question is how do we do meet that homecare need in a prison environment? Prisons are not designed for these kind of interventions."

In the new year the SPS will begin a comprehensive social care needs assessment across the prison estate to measure the likely level of need, with the results due later in 2015. It is likely that the NHS and councils will have to be involved in discussions about potential solutions, the spokesman said.

"As health boards and local authorities move towards the integration of health and social care services for people within their area, based on local need, it is essential that SPS works collaboratively with national and local partners."