The sale of the Royal Hospital for Sick Children in Edinburgh has been agreed between the NHS and developers.

The 122-year-old site, known as the "Sick Kids", will be sold to developers Downing when the hospital transfers to a new premises next year.

However, the local group which was attempting to buy the site said the deal came before its bid had been considered under new "community right-to-buy" legislation.

The Marchmont and Sciennes Development Trust (MSDT) said the sale process should have been paused while its bid was considered by ministers.

Missives were concluded between NHS Lothian and the developers last week, with the sale expected to be worth tens of millions of pounds.

Several developers had been eyeing the Sciennes Road site for luxury flats, but the community group wanted to see it used for affordable housing and small businesses.

An MSDT spokesman said: "We are gutted that we have not even had the chance for our application to be judged by the Scottish Government, which appears to be in the dark about this sale.

"Only yesterday (Thursday) the government's community land team told us they had issued a prohibition notice to NHS Lothian, which would have forced the sale process to be paused while our application was being considered by ministers.

"It turns out the sale had already been concluded by NHS Lothian ten days ago.

"This application was considered by many as an 'acid test' for the new urban right-to-buy laws and we feel very disappointed, as will many people in the community around the Sick Kids, that we did not get the chance to show how it would work."

The spokesman said their application process had been "dogged with delays" and new community facilities were now less likely.

NHS Lothian's deputy chief executive Jim Crombie oversaw the sales process.

He said: "It has been a competitive process but the prospective purchaser showed keen interest in the important legacy for the site through their proposed mixed-use development which will also provide significant capital support to the new hospital.

"Downing is still formulating their detailed plans and we anticipate further community engagement will take place as the developer prepares their planning applications."

A new, purpose-built facility is due to replace the hospital next year, after which it will be rebranded.