Accident and emergency (A&E) departments in Scotland's hospitals have produced their best performance against waiting-time targets in two years.

A total of 95.8% of all patients were seen and either admitted, transferred or discharged within four hours in July, the best monthly performance since the same period in 2013.

But official NHS figures also showed the A&E departments had their lowest level of recorded activity for that month for the last five years, with staff dealing with 131,948 cases in July.

The Scottish Government has set the interim target of having 95% of patients in A&E dealt with in four hours, with figures for the week ending August 23 showing this was achieved, with 95.3% treated in the target time.

Just 35 patients had to wait eight hours or more to be treated and no patients were kept waiting for 12 hours.

Health Secretary Shona Robison said the latest figures were "extremely promising". She warned, though, that more would need to be done to achieve the target in the busier winter period.

Ms Robison said: "It is extremely promising that our A&E departments are seeing and treating 95% of patients within four hours.

"NHS staff have been working extremely hard to cut waiting times and deliver a first-class service, and the figures published today are testament to this."

While she said A&E departments had "moved on considerably in recent weeks", the Health Secretary added that "performance can fluctuate and I am clear that more needs to be done to continue to improve and maintain performance as we head towards next winter".

Ms Robison said: "In order to achieve this, we have put record funding and staffing in place, and have shown our commitment to tackling delayed discharge through our £100 million investment as well as through the ongoing integration of health and social care.

"We have also issued winter guidance to health boards almost two months earlier than last year to ensure they build in optimum levels of resilience capacity in preparation for winter.

"Health boards are also continuing to progress with our six essential actions which aim to minimise long waits in A&E and assessment units by improving patient flow throughout all areas of the hospital and community.

"Long waits in the week ending August 23 are also the lowest they have been in any single week since April 2014.

"We want to see long-term, sustainable change put in place in order to maintain this high level of performance during peaks and troughs of demand."