Rio de Janeiro (AFP) - Joseph Schooling was just 13 years old when he first met his idol Michael Phelps, but he was already hatching the plans that led to one of the greatest boilovers in Olympic swimming history.
Neither Schooling or Phelps knew it at the time, but that brief encounter helped inspire Schooling to not only win Singapore's first Olympic gold medal but also slay his childhood hero in his final individual race, the 100 metres butterfly, at Rio on Friday.
Schooling was already Singapore's best age-group swimmer with ambitions to represent his country, but his goals suddenly changed in 2008 after he met Phelps, who was in the tiny city-state attending a US training camp before the Beijing Olympics, posing for a photo with him.
By the time Phelps had finished re-writing the records books in China, Schooling's mind was already made up. He too wanted to be an Olympic champion, but to do that, he knew he had to leave home.
His parents contacted Sergio Lopez, who won a bronze medal for Spain in breaststroke at the 1988 Seoul Olympics, but was making a name for himself as a master coach.
Schooling moved to Florida to train and live at the Bolles School, where Lopez had just been appointed head coach, and they got to work straight away.
Lopez adopted a patient approach with Schooling, resisting the temptation to get him in the gym to build more muscle, focussing instead on his technique to allow his body to grow naturally.
By 2011, Schooling was starting to make a name for himself. He won two gold medals at the Southeast Games in Indonesia and qualified for the London Olympics in the 200 metres butterfly, but didn't make it past the preliminaries.
Schooling was faced with a dilemma in 2013 after his finished high school. He had been offered a scholarship at the University of Texas to train under Eddie Reese but had also been enlisted to start two years of National Service, a statutory requirement for all Singaporean men.
- 'Special talent' -
The Singapore Sports Institute asked that Schooling be allowed to defer his service for three years in order to prepare for the Rio Olympics and the ministry agreed.
"They listened to what we had to say, that he was a special talent and these people don't grow on trees. They're once in a lifetime, particularly in small nations," Sport Singapore's head of high performance Richard Gordon told AFP.
"One of the unique features of Singapore is National Service and if there's one thing that we're very proud of is to give him the opportunity to keep swimming."
That decision paid off. With Lopez having laid the groundwork, Reese began to apply the polish as Schooling grew and matured, training and racing against the world's best in relative anonymity.
He was already a sporting celebrity in Singapore but by remaining in the US, Schooling was also spared the daily scrutiny most sports stars experience, rather than living life in a fishbowl.
He won a silver medal in the 100m butterfly at the 2014 Commonwealth Games then became the first Singaporean man in 32 years to win a gold medal in swimming at the Asian Games in South Korea.
In 2015, he showed that he was going to be a medal contender for Rio when he finished third at the world championships in Russia, albeit with Phelps absent.
No Singaporean had ever won an Olympic medal in swimming so Schooling's bid captured the imagination of the whole country.
Already an economic powerhouse with one of the world's best education systems, the Singaporean government has begun investing heavily in sports and knows the impact Schooling's win will have on nation.
"Winning isn't everything but it does have a galvanising impact and it inspires and that's important," the President of the Singaporean National Olympic Committee Tan Chuan-Jin told AFP.
"The ecosystem is important because no athlete can succeed without it. And at this high level, it's not just working hard, it's also working smart."
The Singaporean President Tony Tan flew to Rio to sit poolside when Schooling won the gold medal in front of a global audience which had expected to see Phelps win his last race but instead witnessed one of the biggest sporting upsets ever and Singapore's greatest sporting moment.
"People talk about the Kennedy moment when Kennedy was shot," Gordon said.
"This isn't as tragic as that but this is Singapore's Kennedy moment, where people will remember when Joseph Schooling won gold at the Olympics.
"Now the focus will be on Joseph Schooling and how did Singapore do it."