From Danny Boyle's original, clever and heartwarming opening ceremony to last night's closing moments, the London 2012 Olympic Games have proved a triumph both in and out of the sporting arenas.

Team GB gave its best performance since 1908 to win 64 medals in 15 sports to provide the whole country with a sense of achievement. But games will also be cherished for historic moments such as the standing ovation given to Sarah Attar, the first woman from Saudi Arabia to compete in track and field at the Olympics.

While the British display of sporting excellence was due to exceptional dedication by the athletes, it could not have been achieved without the transforming effect of Lottery funding that has provided coaches, nutritionists, state-of-the-art training facilities and vastly improved equipment. That has pushed the question of continued funding for sport to the top of the immediate political agenda and prompted David Cameron to pledge British athletes will get £125 million a year funding until 2016, when the next Olympics will take place in Rio. Catching the mood of the moment, the Prime Minister has also said £1 billion is to be invested in school sports in England over the next four years.

Scots politicians, already calling for a fair share of the Olympic legacy to be guaranteed for Scotland, must find ways to invest in school sports. The Commonwealth Games in Glasgow in 2014 offers a unique opportunity to provide a focus for the interest in sport sparked by the Olympics, which must be seized, particularly for girls who have become less keen on competitive sports.

Women such as Katherine Grainger, Jessica Ennis and Nicola Adams, winner of the first women's Olympic boxing competition, have given a powerful message to girls now at school. They should be in no doubt that fitness not only gives an enviable body shape but that taking part in sport is a lot more fun than dieting. That must start in school. The Scottish Government's plans to create community sports hubs must extend across the country. Schools are at the heart of every community and their sports facilities should be also.

A major factor in the success of the London games has been the cheerfulness of the thousands of volunteers and the helpfulness of ordinary Londoners in providing assistance to visitors. Since Glaswegians have long had a reputation for going out of their way to help strangers, it shouldn't be difficult to build on that example of harnessing the power of voluntary helpers for 2014 but it will take organisation.

The very success of the London games has set a formidable challenge to Glasgow in 2014. Confined to the family of Commonwealth nations, friendship sets the tone for the Commonwealth Games, although competitiveness will be fierce with Commonwealth athletes having won 123 medals across the Olympics. Already hopes are running high that the incomparable Usain Bolt will follow his historic feat of taking gold at both 100m and 200m gold at successive Olympics with a repeat performance in 2014. Equally anticipated is the prospect of Sir Chris Hoy, Britain's most successful ever Olympian with a total of six gold medals and one silver, competing in the velodrome named after him.

Such international events, however, come with a very high price-tag. On current calculations, the London games are expected to eventually generate £13bn for the £9bn cost. Similarly, the Commonwealth Games cannot be judged on sporting performance alone. It will be thrilling to see home-grown athletes emulate the Scots' superb Olympic tally of 13 medals including seven golds but if Glasgow 2014 can build on the momentum of London 2012 to turn a culture of watching sport into one of participating, its legacy will be truly golden.