The minister indicated delays in well patients going home are behind the crisis currently hitting Scottish hospitals, which has resulted in the sick being left for hours on trolleys in A&E departments this winter.
A team including frontline doctors and Mr Neil is working on an emergency care action plan to prevent a repeat of the bed shortages that have jeopardised the quality of patient care during recent weeks.
It is understood this group has identified the backlog of patients waiting to leave hospital as a key part of the problem, which was sparked by a fast-spreading vomiting bug and respiratory infections pushing up hospital admissions.
A survey of health boards by The Herald had already revealed 7000 patients had waited more than the target time of four hours in emergency units between December 23 and January 6, including almost 300 who waited more than 12 hours for a ward bed and one who waited 23 hours.
Mr Neil said Mr McGarrity's family were right to be upset about the care he received, adding: "My message to the health board and every health board in Scotland is this is not an acceptable level of service and we must make sure this does not happen again."
He said the average time for treating patients in A&E over Christmas and New Year had still been less than three hours, despite the spike in illnesses.
But he admitted issues needed to be tackled in order to prevent long queues for hospital beds over the next festive season.
Mr Neil said: "We actually think the underlying problem is that something like 25% of people who should be discharged are not getting discharged timeously."
It is understood research in four health boards – NHS Borders, NHS Fife, NHS Lanarkshire and NHS Lothian – showed 20% to 25% of inpatients no longer required acute care. The audit found delays were caused by problems inside hospitals, such as staff waiting for consultants to make decisions, and difficulty getting patients assessed by social care workers and putting community care packages in place.
Mr Neil said: "We are moving on a whole range of fronts to make sure the flow of patients is better through the hospital system and reduce delayed discharge substantially."
Details of the emergency care action plan will be unveiled in March, but a new £1 million package of funding to increase the number of A&E consultants in Scotland by 10 is part of the package.
Andrew Lowe, past president of the Association of Directors of Social Work in Scotland, said the reasons for delayed discharges were complicated and it was not a case of councils needing more resources.
Mr Lowe, director of social work in the Scottish Borders, said: "We have changing patterns within hospitals. We have ward closures, we have faster through-put times, so they are driving cases ever quicker.What we are really asking someone to do is make the biggest decision of their later life in a very short period of time – are you going to give up your family home? Very often people want to take time and talk to their family about it."
Patients waiting for places to become available in care homes in the community they know is another factor, he said.
Greg McCracken, policy officer for charity Age Scotland, said: "There has been no significant progress on delayed discharge, with older people remaining disproportionately at risk of being trapped in hospitals far longer than is absolutely necessary."