When Team Scotland officials posted a pre-Commonwealth Games target of breaking their record 33-medal haul of Edinburgh 1986, the declaration was not just the bombast of a host nation looking to capitalise on home advantage.

Years of planning and investment went into making sure Glasgow 2014 would be lifted by the success of Scottish athletes - and the results have been spectacular.

Scotland surpassed their previous best performance halfway through the Games when the men's gymnastics team finished second to ensure their first-ever podium place.

Two boxing golds saw them pass the 50 mark on the penultimate day and they soon made sure they would more than double their 2010 tally of 26, as well as finishing fourth in the medals table.

But Scotland's Commonwealth Games has been far more than an impressive set of statistics.

A set of sporting stars have given the Scottish people collective memories they will never forget. Some of them were established in their sport, others were previously unknown to the majority of the population, but many have propelled themselves into the hearts and minds of the nation.

Lasting images have been engrained such as the smile of 13-year-old Shetland schoolgirl Erraid Davies when she won bronze in the pool; bowls hero Alex Marshall's celebration after a match-winning shot against England; the look of shock on Ross Murdoch's face when he beat team-mate and favourite Michael Jamieson to gold in the 200 metres breaststroke; the emotion on boxer Josh Taylor's face when Flower of Scotland rang round The Hydro; the heroism and determination of Lynsey Sharp in winning 800m silver on the track despite being dogged by illness.

Scotland found new stars such as Dan Wallace, who whipped up the crowd at Tollcross pool, and boxer Charlie Flynn, whose natural enthusiasm and wit in front of the camera, and his rousing rendition of the national anthem, saw him catapulted to instant stardom.

And it found a new sport which it can excel at. The home nation won 13 judo medals including six golds with the likes of Royal Marine Chris Sherrington providing the momentum for glory at the start of the Games.

The key factors in the success appear to be the team spirit and the support of the home fans, coupled with investment and planning in sporting infrastructure, which improved post-devolution in 1998 and was escalated in 2008, after Glasgow won the right to stage the 2014 Games.

An example of the planning process was in bowls - every shot the team members played over an 18-month period was analysed, computer software helping to bring home three gold medals along with the virtuoso talent of the likes of Marshall.

Team Scotland chef de mission Jon Doig listed his reasons for the unprecedented success.

"Very early investment back in the athletes' and coaches' programmes, great support systems, also the support we have got from local communities," he said.

"Once they have got here, the phenomenal home crowds and the platform Glasgow 2014 has provided them. Put those things together then you have a great team and great result.

"We worked very hard in the lead-up to the Games in terms of getting the athletes together and realising they are part of something huge, and they really respond to that."

That final factor was something that was crucial to Sharp.

"For me, watching how well people did at the start of the Games just inspired me to want to be like them," she said.

And for Murdoch, who also won a bronze in the pool, the home backing was key.

"It's definitely been the Scottish support," the 20-year-old told Press Association Sport.

"I don't think there's any other country in the world that can support the way Scotland has got behind us.

"That roar for me coming down the last 50m for that 200m breaststroke pushed me on to do something special that night that I didn't believe I could do.

"I'll never forget that and I don't know when I'll get that again. I would love to experience it again."

Murdoch has time on his side to do just that and he hopes that others are inspired to follow in his footsteps.

"The defining moment where I decided I really wanted to become a professional athlete was after the London Olympics," he said.

"I watched Michael Jamieson get the silver medal in the 200m breaststroke and that proved to me I could do something like this if I worked hard enough.

"Because Team Scotland has had such a good Games as a whole, I think we have shown the kids of future generations that we can perform on the senior stage, and all it takes is hard work and determination and you can get there.

"You follow your dreams, do what you love and enjoy it on the way.

"I want all the best for Scotland in the future in sport as well. I don't want it to wither out, I want us to thrive past this.

"I hope this Games does go down as a legacy and people thrive off the success we had here."