Scottish councils spent more than £1.7m on events associated with the Queen's Baton Relay, according to data obtained by BBC Scotland.
After visiting all 70 Commonwealth nations, the relay culminated in a 40-day tour of Scotland before the start of the Commonwealth Games in Glasgow.
Glasgow, North Ayrshire, and Perth and Kinross councils were the biggest spenders.
The main costs involved entertainment, traffic management, and publicity.
Glasgow City Council, which hosted the 2014 games, contributed £500,000 towards the cost of staging the baton's four-day tour of the city.
The baton - the Commonwealth's version of the Olympic torch - contained a message from the Queen, which was read out at the opening ceremony on 23 July.
- You can see what each council spent money on using the INTERACTIVE MAP developed by BBC Scotland - just hover over a local authority to see an itemised list of expenses.
The data - obtained through a series of coordinated Freedom of Information requests - reveals many councils spent more on the relay than other local authorities representing larger populations.
For example, North Ayrshire (£150,007) and Perth and Kinross (£112,373) spent more than Edinburgh council - despite representing a population a third the size of Scotland's capital city.
Some of the costs incurred by Perth and Kinross included fireworks (£6,101) and flights for bands and presenters (£2,869).
Some of the more unusual costs in the data
- £2,395 - the amount spent on pyrotechnics by East Renfrewshire council;
- £1,602 - the amount spent on 40 medals by West Lothian council;
- £1,207 - the amount spent on confetti cannons by Renfrewshire council;
- £574 - the amount spent on a pilot boat by Orkney council;
- £133 - the amount spent by Clackmannanshire council on two plaques presented to Lesotho, and St Kitts and Nevis, which have towns the local authority was twinned with for the games.
Other smaller local authorities featuring in the list of top 10 spenders included: South Ayrshire (£68,265); Renfrewshire (£55,122); East Renfrewshire (£48,295), and East Lothian (£46,752).
Most councils were awarded £10,000 grants by EventScotland, as part of their Games for Scotland programme meant to celebrate the relay through community-led events, to allay some of the costs.
Aberdeenshire and East Lothian councils also received additional funding (£10,000 and £7,565 respectively) from Creative Scotland, and nine local authorities received £10,000 grants from the Big Lottery Celebrate funding programme.
'Excellent value for money'
A spokesperson from North Ayrshire council defended the amount spent on hosting events which they said attracted more than 22,500 people.
"The funding spent was just over £1 per head for the people of North Ayrshire and, we believe, represents excellent value for money, given the lasting legacy of community engagement and benefits.
"Since the relay route for North Ayrshire did not include a visit to our island community of Arran, the Council funded 300 free return ferry tickets to bring Arran residents to the mainland and allow them to join in the End of Day celebrations.
"Given the high number of community groups and residents supporting and participating in this event, the cost of hiring infrastructure - such as staging, crowd control barriers etc - was considerable."
Claire Monaghan, the head of communities for South Ayrshire Council, also justified the £68,265 spent by the local authority.
"The detailed and comprehensive costings provided to the BBC cover everything from grass cutting and first aid to traffic management - which was all about ensuring the safety of our communities during the relay."
She added: "The bulk of our costs were for the generic Commonwealth flag bunting we installed along the entire length of the relay route throughout South Ayrshire.
"The bunting, which we've had very positive feedback about, remained in place in our towns and villages throughout the summer until after the Commonwealth Games and has since been given to many community councils, groups and schools for use at future events and celebrations, making sure our expenditure marks a longer-term investment for our communities."
A spokesperson from Perth and Kinross council said there was a reason why they had spent more than local authorities with greater populations: "While we are the thirteenth largest area by population; geographically we are the fifth largest council area in Scotland."
The spokesperson added: "By demonstrating that Perth can host big events... such as the concert which took place on the same day as the Queen's Baton Relay, we are able to increase the profile of the area."
Similarly, a spokesperson from East Renfrewshire council defended its relay expenditure, saying its major events programme had generated £1.1m over the past few years.
A statement said: "Encouraging people of all ages to get involved in sport is a key objective for the council, and naturally providing support for Queen's Baton Relay at a grassroots level - particularly in some of our more deprived areas, was very important to us."
Meanwhile a Glasgow 2014 spokesperson said the public response to the relay had been "incredible".
They added: "The coordination and promotion of the relay in Scotland was a positive collaboration between Glasgow 2014, Commonwealth Games Scotland and each of Scotland's 32 Local Authorities.
"The planning for local celebrations included the option for councils to buy banners and branding to dress streets and landmarks."
- Midlothian Council
- West Dunbartonshire Council
- Angus Council
- South Lanarkshire Council
- East Dunbartonshire Council
- Dumfries and Galloway Council
- South Ayrshire Council
- Dundee City Council
- Shetland Islands Council
- East Renfrewshire Council
- Aberdeenshire Council
- North Ayrshire Council
- Orkney Islands Council
- Clackmannanshire Council
- Glasgow City Council
- Perth and Kinross Council
- Renfrewshire Council
- Highland Council
- City of Edinburgh Council
- Argyll and Bute Council
- East Ayrshire Council
- East Lothian Council
- West Lothian Council
- Falkirk Council
- Aberdeen City Council
- North Lanarkshire Council
- Fife Council
- Stirling Council
- Moray Council
- Inverclyde Council
- Scottish Borders Council