An agreement has been made to protect the historic Mavisbank House in Midlothian.
The country house was the first palladian villa to be built in Scotland. It has been derelict since a fire swept through the house and caused serious damage almost 40 years ago.
The agreement is to be signed by Historic Scotland and Midlothian Council which will mean that they will compulsorily purchase the Category A property.
The two bodies then plan to transfer the ownership of Mavisbank House to a local trust.
The house was designed by William Adam in 1722 and is near the town of Bonnyrigg.
Historic Scotland has described it as one of the country’s most important houses due to its architectural heritage.
The fire in 1974 caused significant damage to the house but the Mavisbank Preservation Trust believe that the building can be restored.
The house is privately owned, but no one currently knows who the owners are.