Staging the G8 summit in Scotland last year cost Edinburgh more than £8m.
Extra officers were drafted in to tackle protests in Edinburgh
Figures showed that the city's council spent more than £3m while Lothian and Borders Police shelled out almost £5m.
The Scottish Executive has agreed to cover almost all the costs, which include police overtime and council expenses for road closures.
It follows a report commissioned by the executive, which revealed that Edinburgh businesses lost £7.4m in sales due to the G8 disruption.
However, the same study also claimed the city had benefited by more than £10m from the Make Poverty History parade and the Live8 concert.
Police had to deal with running battles on Princes Street, as well as protecting both the Palace of Holyroodhouse and the parliament.
The city council incurred costs through helping to stage the Murrayfield pop concert as well as organising a campsite for protesters.
A Lothian and Borders Police spokesman said the force's total costs were £4.91m, which included manning the huge security operation in Edinburgh and at Gleneagles.
"Most of the extra costs would have been for overtime payments for officers, although the force was compensated for things like the mutual aid it provided to other forces, public order training and pre-planning for the summit," he said.
An Edinburgh Council spokeswoman, said: "G8 was a huge opportunity for Edinburgh to be on the world platform and promote itself as an 'Inspiring Capital'.
"As the largest ever event outside London, it was a huge achievement to allow people their right to democratic protest while keeping people safe."
Shami Khan, a member of Lothian and Borders Police Board, said: "The police worked very hard during the week of the summit protecting businesses and property in the city and ensuring disruption was kept to a minimum."
The total cost of security and policing for the G8 summit in Scotland was £72m.