The Scottish Government has been urged to "get a grip" on bed blocking after new figures showed more patients were kept in hospital when they were medically well enough to leave.

A census across Scotland's hospitals carried out in June revealed 1,159 patients whose discharge had been delayed - including 175 who had been waiting six weeks or more.

Across the NHS in May, patients spent a total of 44,305 days in hospital when they were medically well enough to leave, a rise from 43,980 the previous month.

Health Secretary Shona Robison said the latest figures showed a 6% fall in the number of bed days lost compared to the same month last year, and a drop of 14% compared to two years ago.

Opposition parties highlighted the increase in bed blocking - which happens when patients are clinically ready to leave hospital but are waiting for the necessary care, support and accommodation arrangements to be put in place.

In April 2015 the Scottish Government introduced the target that nobody should have to wait more than two weeks to be discharged.

The total of 1,159 delayed discharges in June's research is up by 3% from May's census and includes 338 patients with specific, complex care needs.

Of the remaining 821 patients who were held up, 262 (32%) were waiting for a place in a care home and 204 (25%) were waiting for arrangements to be made so they could be cared for in their own home.

A further 181 (22%) were waiting for a post-hospital social care assessment to be completed.

Labour health spokesman Anas Sarwar said: "Yet another increase in delayed discharges, yet another broken promise from the SNP who promised to eradicate it a year ago.

"Our NHS staff are doing the best they can under the circumstances but they are over-worked, undervalued and under-resourced.

"The lack of funding to health boards and social care from the SNP government will only make this worse."

Liberal Democrat health spokesman Alex Cole-Hamilton said: "The integration of health and social care was largely targeted at reducing delayed discharges.

"But in the months after it went live the figures show that the number of routine cases has increased month on month.

"We all want to see the integration of health and social care succeed but ministers need to get a grip."

Ms Robison said: "Good progress is being achieved in reducing delayed discharge, with these latest statistics showing a 6% reduction in the number of bed days lost compared to the same month last year - and a 14% reduction compared to the same month two years ago.

"We know more needs to be done and that is why we will continue to invest £30 million a year to tackle this problem.

"Our investment so far has been used to open intermediate care beds, assess people in more appropriate settings and to focus on caring for people at home by investing in home care, telecare services and reablement."