The number of patients kept in hospital after being told they were well enough to leave has fallen, new figures have shown.

Official statistics from a census carried out in hospitals in March found 1,339 patients had to remain in hospital due to delayed discharge, also known as bed blocking.

The figure has fallen for the third consecutive month, down from the 1,439 recorded in February and 1,482 in January.

The report by ISD Scotland shows although fewer patients were affected, more days were spent in hospital due to delayed discharge in March than in February.

Patients spent 41,493 days waiting to be discharged in March up from 40,246 days the previous month.

Delayed discharge happens when patients are clinically ready to leave hospital but are waiting for the necessary care and accommodation arrangements to be put in place.

A total of 1,089 (81%) of patients were delayed for more than three days and of these patients the majority, 776 (71%), were affected by health and social care delays, down from 834 in February.

Other delays of more than three days were due to the complex needs of the patient in 266 cases (20%) and family-related reasons for 47 patients (4%).

Health Secretary Shona Robison said: "The integration of health and social care ensures patients are at the heart of care decisions and receive more treatment in the community, reducing demand for acute hospital usage by reducing avoidable admissions, lengths of stay and delayed discharge.

"Our key measures are reducing bed days and increasing the amount of delayed patients discharged within three days.

"Following the annual decrease of 9% in 2015/16, 11 out of 12 months during 2016/17 were below the equivalent month on the previous year. Delays over three days are also at their lowest level since we changed our recording practices last July.

"We're making good progress and continue to work to eradicate this problem with a further £107 million transferring from the NHS in 2017/18 for integration purposes, taking the total NHS contribution to enhance social care to around £500 million per year. This includes £30 million specifically to address delayed discharges."