The Scottish Fire and Rescue Service has admitted health and safety breaches in connection with the "tragic death" of a "popular and highly regarded" firefighter.

Ewan Williamson, who was 35, died as he fought a blaze in the basement of the former Balmoral Bar in Dalry Road, Edinburgh, on July 12 2009.

At the High Court in Edinburgh today, the fire service (SFRS) admitted breaches under the Health and Safety at Work Act.

Mr Williamson was working for Lothian and Borders Fire and Rescue Service - now the east division of the national service - when he died in the line of duty after becoming lost and trapped in the burning building.

He was the only firefighter in the history of the Lothian and Borders Fire Service (LBFRS) to die while tackling a blaze.

The SFRS took over from the eight regional fire services in 2013.

Mr Williamson's family and senior members of the fire service were present in court.

The service pleaded guilty to failing "to have in place an effective system of radio communication" and failing "to have in place an effective system of implementation of procedures for firefighters using breathing apparatus" during the fire at the Balmoral Bar.

It also admitted failing to "adequately monitor and ensure attendance by firefighters at training courses" and failing to maintain accurate training records for them between July 13 2008 and July 12 2009.

It further admitted failing to "adequately train firefighters to ensure close personal contact was maintained during firefighting and search and rescue activities" in the same period.

Explaining the circumstances of Mr Williamson's death, Advocate Depute Iain McSporran told the court that he had become separated from his colleague Oliver Carrigan after taking a wrong turn as they exited the smoke-filled bar.

The firefighters had been attempting to locate the blaze in the basement, but had retreated due to zero visibility and extreme heat.

They were following a hose line to find their way out of the building when they became separated.

When it was discovered that Mr Williamson had not followed his colleague out, radio messages revealed that he had turned left instead of right, and had become stuck in the men's toilets on the ground floor, which was located directly above the fire in the basement office.

"It is evident that firefighter Carrigan and his partner did not maintain sufficiently close personal contact," Mr McSporran told the court.

A "BA emergency" - meaning firefighters wearing breathing apparatus are in trouble - was launched, and several unsuccessful attempts were made to locate Mr Williamson before the building was evacuated after the floor collapsed.

His body was eventually recovered through a boarded up window.

The cause of death was recorded as uncertain, but the professor who jointly carried out the post-mortem examination said the effects of heat and suffocation could not be ruled out.

Investigations revealed the fire was likely to have been started by a lit cigarette being disposed of in a waste bin containing papers, while it was also discovered that the floor of the bar did not comply with building regulations.

Mr McSporran said: "It is accepted by SFRS that there were organisational failings, which constituted breaches of the Act, and that one part of those failings - namely to have in place an effective system for training of procedures for the use of breathing apparatus, specifically the maintenance of close personal contact - was causally linked to the death of firefighter Williamson.

"All other aspects of the charge, whilst accepted contraventions of the Act, are accepted by the Crown not to have any causal connection to the consequences of July 12 2009."

Acting for the SFRS, Peter Gray QC said: "This case has many tragic aspects to it. One of the most tragic is that in the vast majority of cases where a firefighter makes an error it has no consequences.

"In the vast majority of circumstances Ewan Williamson would have been out in a minute as he was recorded having said on the radio."

Had it not been for the "buckling floor" underneath his feet, "he would have opened the door, been found and left the premises", he said.

Mr Gray said: "Ewan Williamson was a very popular and highly-regarded member of (the LBFRS)."

His "loss was felt deeply throughout the LBFRS community, from the most junior firefighter to the chief of that service".

"It is a matter of profound and continuing anguish that Ewan Williamson's loss can be attributed at least in part to a failing in a system of work that LBFRS was responsible (for)," Mr Gray added.=

"The loss of Ewan Williamson shook the close-knit community of LBFRS to its core. Six years on, his loss continues to be felt."

Judge Lord Uist adjourned the case until March 20 for sentencing.

The Fire Brigades Union (FBU) welcomed the development at court.

Stephen Thomson, Scottish FBU secretary, said later: "The FBU welcome the decision by the Scottish Fire & Rescue Service to plead guilty today and we hope that this will help Ewan's family move on with their lives."

Lothian and Borders FBU officials said they have spent the last five-and-a-half years supporting Ewan's family and its members since his death.

Denise Christie, of the FBU in Edinburgh, said: "It's been a very difficult time for all those involved and I hope that this can now be the start for everyone to move on without the anxiety of a court case hanging over them.

"Ewan was a brilliant firefighter, a great friend to all at Tollcross Green Watch and throughout the fire service and beyond. He will never be forgotten and will always be in our thoughts."