The funeral and lying-in-state of the late Queen Elizabeth cost the UK Government an estimated £161.7 million. 

The total cost to the Scottish Government is estimated at £18.8 million, according to figures published by the Treasury. 

This will have included costs for the lying-in-rest in Edinburgh following the death of the monarch at Balmoral Castle in Aberdeenshire. 

Scots were able to pay their respect at the capital's St Giles Cathedral before her coffin travelled to Westminster Hall.

READ MORE: In pictures: King Charles III leads mourners at St Giles' Cathedral service of thanksgiving for the Queen

HeraldScotland: Royal Archers at St Giles\' Cathedral for a Service of Prayer and Reflection for Queen Elizabeth\'s life. Photo: Euan Cherry/Daily Mail/PA Wire..

The Treasury published the figures on Thursday which also showed the Home Office spent £74m on the events, while the Department of Culture, Media and Sport spent £57m.

Other costs include £2.9 million by the Ministry of Defence, £2.6 million by the Department for Transport, £2.2 million by the Welsh Government and £2.1 million by both the Foreign, Commonwealth and Development Office and the Northern Ireland Office.

The Treasury said that the costs include “fully refunding” the Scottish and Welsh Governments, and the Northern Ireland Office, “which in turn they were able to repay to partners who also incurred costs”.