The number of patients forced to wait too long in accident and emergency (A&E) departments has almost trebled in five years, according to a study across the NHS in Scotland.

About 104,000 people waited beyond the standard four-hour target in 2012-13, compared with about 36,000 in 2008-9, Audit Scotland found in a new report.

The proportion of people being seen within the four-hour target fell from 97.2% at the end of 2009 to 93.5% by December last year, it revealed.

The health service has rarely achieved the Scottish Government's 98% standard four-hour target over the study period, although there are signs of improvements.

Caroline Gardner, auditor general for Scotland, said: ``A&E departments provide a really important service in assessing and treating patients with serious injury and illness.

``Maintaining good performance in A&E was one of the Scottish Government's key objectives in 2013-14.

``Delays in A&E can be a sign of pressure across health and social care. While there has been improvement in performance, such as the progress made in tackling the longest waits in A&E, performance against the target still remains lower than it was when we last reported.

``It is important that the Scottish Government and NHS boards build on their whole system work and continue to reduce delays for A&E patients.''

The study also discovered a spike in admissions during the last 10 minutes of the four-hour period.

More than 18% of admissions from A&E at the Royal Infirmary of Edinburgh were recorded just before the time limit passed.

Scotland has 31 A&E departments which saw about 1.35 million patients in 2012-13 at a cost of about £163 million, Audit Scotland said.

The report shows variation in demand at A&E across the country.

The Royal Sick Children's Hospital in Edinburgh recorded an increase of about 15% over the five years while, at the other end of the scale, demand fell by about 13% at Gilbert Bain Hospital in Lerwick, Shetland.

Gilbert Bain and the Royal Aberdeen Children's Hospital were the only two to meet the 98% target in each month of the financial year 2012-13. Most other hospitals failed in every month.

The report notes that action is being taken by the Scottish Government and that the situation has improved in recent months.

The Government announced a national plan in February last year to improve emergency care.

The NHS plans to invest about £50 million in unscheduled care between 2013-14 and 2015-16.