NHS Lothian paid an extra £11.6 million to the consortium building the delayed children's hospital in Edinburgh to fix drainage problems and void fire detectors after being advised that it was too risky to sue the group in court.

A report commissioned by Audit Scotland details how the health board first raised the threat of legal action in relation to the troubled project in September 2017.

The report said NHS Lothian had "identified a number of issues that it believed were non-compliant with the original contractual requirements" for the Royal Hospital for Children and Young People (RHCYP).

However, in May 2018 NHS Lothian eventually opted against legal action following expert advice. Instead, it reached an agreement to pay £11.6m to the consortium in charge of the hospital project, IHSL Ltd, in exchange for carrying out works required to complete the facility.

The payment, in addition to £150m for the hospital's construction and £80m for enabling and equipment works, was signed off jointly by the Scottish Government and NHS Lothian.

READ MORE: Sick Kids contractor now behind three crisis-hit hospital builds 

The Audit Scotland report noted that the payment was intended to resolve three technical problems in particular, relating to "a drainage solution, heater batteries, and void fire detectors".

The watchdog stressed that the "extensive analysis and resources" were committed to "weigh up the pro and cons" of different scenarios before the decision was taken to settle the dispute out-of-court.

It added: "NHS Lothian has consistently maintained its position that the issues experienced were materially non-compliant with the original specifications and raised concerns over the facilities for patients, visitors and staff (relating to aspects such as function, safety, adequacy and future capacity).

"However, legal and contractual expert opinion did not give the board sufficient confidence that the likely benefits of pursuing resolution through legal redress in the courts outweighed the qualitative and quantitative implications of such a route."

READ MORE: Clinicians 'pressured' to sign off flawed hospital plan, says architect

The details emerged in Audit Scotland's annual summary of NHS Lothian's finances, which predicts that the health board will face a funding shortfall of £26m in 2019/20 rising to more than £80m by 2021/22.

However, the report was completed in June before the latest delays to the opening of the new children's hospital.

Plans to begin admitting patients from July 9 - more than two years later than originally planned - were axed after a last-minute inspection found fault with the ventilation systems in critical care. It has also been blighted by drainage problems.

Health Secretary Jeane Freeman has commissioned a safety review which is expected to conclude in September, while private consultants KPMG are investigating the governance of the project.

READ MORE: Timeline of a project blighted by dispute and delays

However, it is unclear when the hospital will open.

Scottish Labour Health spokeswoman Monica Lennon said: “The government has clearly known for some time about the serious issues around governance and problems with the progress of the contract for the new Sick Kids hospital Edinburgh.

“With the publication of this report, it begs the questions of why the Health Secretary hasn’t previously mentioned it and how the situation has been allowed to progress to this stage."

Despite not being able to use the facility, NHS Lothian is also paying around £1.4m a month to IHSL Ltd in maintenance and management fees as part of a 25-year deal.

A spokesman for Brookfield Multiplex, the contractor for design and build within the consortium, said that if any modifications to the hospital are necessary it "will provide such assistance to NHS Lothian as may be required".

The Australian construction company was also responsible for building the Queen Elizabeth University Hospital and the Royal Hospital for Children in Glasgow, which are now subject to a review following infections potentially linked to faulty ventilation and water supply systems.

Dr Craig Dalzell, head of policy and research at the think-tank Common Weal, said the fiasco underlined the case to stop outsourcing major projects to the private sector under PFI-style deals.

The think tank has proposed creating a Scottish National Infrastructure Company which would manage procurement while being directly accountable to the Scottish Government and funded via the Scottish National Investment Bank.

Dr Dalzell said: "We simply can’t keep building critical public infrastructure like we’re not planning to actually use it for decades after construction is completed. We need to start building for quality and longevity – not for speed and profit."