The number of patients having to wait longer than the target time to be discharged from hospital has soared, new figures show.

In July this year, 274 patients in Scotland were forced to wait more than four weeks after they were ready to be sent home, according to NHS statistics.

That compares to 173 in April and 118 in July last year.

Delayed discharges - also known as bed blocking - happen when patients are ready to leave hospital but their necessary care, support and accommodation arrangements are not yet in place.

The current target states that nobody should wait more than four weeks from when they are clinically ready to be discharged, with that target set to come down to two weeks next April.

Of the 274 patients who were affected last month, 128 were waiting for a place in a care home.

Figures show there were also 175 patients delayed for more than six weeks, a rise from 107 in April.

The Scottish Government said it has set up a task force with the local government group Cosla to tackle the problem and make "immediate improvements".

Health Secretary Alex Neil said: "We have come a considerable way in tackling this problem, with comparable figures for 2006 showing three times as many people were delayed for over four weeks.

"However, it's disappointing that some patients are still delayed for lengthy periods in our hospitals. Remaining in hospital, when clinically ready to leave, is frustrating for individuals and can pose challenges in ensuring effective patient flow through the hospital.

"Integration of health and social care will be key to driving down delays, and we are working with Cosla to deliver integration for the benefit of people across Scotland.

"We recently announced an additional £5 million to be targeted at the areas with the greatest challenges. This money will be used by seven NHS and local authority partnerships to reduce delays and release hospital capacity."

Councillor Peter Johnston, Cosla's health spokesman, said: "This is a priority of the first order - we know that for older people in particular, a delay of longer than 72 hours can have an impact on their health and well-being.

"We in Cosla are determined to make further progress on discharge arrangements. We hope to get to a position in time where service redesign can build community capacity to ensure that people are only admitted to hospital because they really need to be there and are then discharged speedily back to their own homes."