Tensions over the £72m cost of policing the 2005 G8 summit at Gleneagles have been revealed in newly released government papers.
They show the then Scottish Executive wanted the UK government to cover the full amount.
But resistance from the UK Treasury saw it only contribute £20m.
National Records of Scotland files show former first minister Jack McConnell warned his administration was being placed in an "intolerable position".
Warnings that the executive would expose fears about the cost of G8 summit security publically were issued, the papers reveal.
A huge police presence, with officers drafted in from across the UK, was put in place for the 2005 meeting of leaders from the world's foremost industrial nations.
Trouble flared on a number of occasions with confrontations between police and protesters in Edinburgh and at Auchterarder, next to the summit venue.
'Very serious situation'
Scottish Executive cabinet papers from eight months before the summit took place show the potential policing costs were a "major concern" for the then Labour and Lib Dem coalition.
In one paper an official notes it was "potentially a very serious situation because costs associated with the summit would inevitably be in the public domain".
It adds, "In the event that it proved impossible to make sufficient progress, cabinet would need to consider the consequences of various options, including a major public dispute with the UK government.
"The first minister has made it clear to senior members of the UK government that failure to reach an agreement on policing and security costs would place the executive in an intolerable position which it would feel obliged to explain publicly."
World leaders from the United States, Canada, Russia, France, Italy, Germany and Japan joined the then UK prime minister Tony Blair at Gleneagles where they discussed development in Africa and global climate change.
Nearly 2,400 delegates attended the summit, and a similar number of media representatives were accredited to cover the event.
An exclusion zone was put up around the venue but disturbances took place across Scotland.
Another section of the newly released executive cabinet paper suggests "we might want to make the case that it is only because Scotland is part of the union that we have this opportunity".
However, the paper cautions this was a "double-edged sword" given the opposition in some quarters to Scotland hosting the G8 summit, adding that some critics would argue Mr Blair had "foisted a poisoned chalice on Scotland".
The total cost of the hosting the G8 summit was £90.9m, with £72m spent on policing.
The Treasury agreed to pay £20m of the cost, £10m was paid by the Foreign Office, with the remaining bill being met by the executive.
A study into the impact of the event suggested spending directly linked to the summit was worth £65m to the Scottish economy, while the value of worldwide media coverage at more than £66m.