THOUSANDS of patients have had to spend more than eight hours waiting in accident and emergency departments this winter as hospitals ran out of beds..

Official figures, just released, show one of the worst performances against the Scottish Government target for the frontline of the NHS in years and record numbers of patients seeking emergency treatment.

In the month of December 89.9 per cent of patients were dealt with by A&Es within four hours, against a goal which has been revised down from 98 per cent to 95 per cent.

During the last three months of 2014, 517 patients had to spend more than 12 hours queueing and 4,028 more than eight.

Dr Martin McKechnie, an A&E consultant and vice president (Scotland) for the College of Emergency Medicine, said these patients would have been seen by clinicians but were stuck lying on trolleys in corridors waiting for empty beds.

"It is deeply distressing for patients and their families and the staff who do not want to provide care in such a way," he said. "You are more likely to miss having your treatments on time - administration of painkillers and antibiotics are often better done on wards by staff who do that routinely."

Patients are also more likely to develop pressure sores if they spend a long time on a trolley, he said, and international studies have shown higher death rates.

The target for A&Es to treat and discharge or admit patients within four hours is sometimes controversial, but it can serve as a barometer for the whole healthcare system. If patients are backed-up in A&Es for a long time, it suggests there is a shortage of room on the wards. This, in turn, is a problem which is exacerbated by delays in discharging patients to the community because social care services are struggling to meet demand within budgets.

From around 2007 Scottish hospitals managed to hit - or come close to hitting the four hour target - but by 2012 performance was sliding and that winter it nose-dived below 90 per cent. Politicians blamed this on an outbreak of the winter vomiting bug and respiratory illness but, two years later, the same situation has arisen.

In NHS Greater Glasgow and Clyde 84.5% of patients were dealt with in time in December 2014 - one of the lowest figures for Scotland. The health board said their hospitals were under pressure despite record numbers of nurses and doctors. According to their analysis, the problem has not arisen because there has been a major rise in the number of people turning up but because the patients are sicker and more likely to need a bed and a longer spell in hospital.

National figures show in excess of 1.6m A&E attendances during 2014, the highest number since records began, and between October and the end of December the number of people frontline clinicians admitted to hospital also hit a record 101,488,

Health Secretary Shona Robison said: "These factors have clearly impacted on performance and today's figures do not meet the demanding, world leading targets we have set and the standards that patients rightly demand. We are determined to improve performance, which is why have been taking substantial action to ease pressure on the front door of the hospital, as well as concentrating on the timely discharge of patients."

A number of measures have been announced to try to improve the situation including a £50m package for emergency care, which helped boost staff numbers. More recently Ms Robison said £100m would be given to the new joint NHS and social care boards, which will take over responsibility for adult social care services from April, to reduce delayed discharges and hospital admissions.

There has been some dispute among politicians either side of the Scottish border about which country has better A&E performance figures. The Scottish Government claimed figures for "core" hospital sites put Scotland ahead of England for December at 88.6% against 85.3%. The overall performance data puts Scotland slightly behind England. Comparisons of the published data over time shows only small variations between the two countries.

Scottish Secretary Alistair Carmichael said: "The rise in A&E waiting times over the past three months will be a concern in communities across Scotland.

"Over the past four and half years the UK Government has protected and increased the health budget to meet the demands on our health service. This has meant the Scottish Government have received over £1.3bn of extra funding for spending on health since 2011."