* Australia's first 100m freestyle world champion retires
* Claimed three world titles but suffered Olympic heartbreak (Adds details, quotes, byline)
By Ian Ransom
MELBOURNE, June 5 (Reuters) - Australia's James Magnussen has retired from the pool after a roller-coaster career featuring world domination, Olympic heartbreak and a sleeping pill scandal that embarrassed the nation's swimming community.
A towering, muscular swimmer, Magnussen became Australia's first world champion in the blue riband 100 metres freestyle at Shanghai in 2011 and defended the title two years later at Barcelona.
In between, he would claim two medals at the London Olympics but not the gold he desperately wanted when he was pipped by American 100m winner Nathan Adrian by 0.01 seconds.
A shoulder injury and the emergence of compatriots Cameron McEvoy and Kyle Chalmers saw Magnussen fade out of the picture behind but he battled back to grab a second relay bronze at Rio in 2016 and a third relay gold at last year's Commonwealth Games on the Gold Coast.
"At 28 years of age I feel I could have swum at another Olympic Games, but with the lofty standards I have held myself to over the years and the high expectations I have, I believe now is the right time to step away from the sport," Magnussen said in a statement on Wednesday.
Born and raised in the seaside town of Port Macquarie, Magnussen broke into Australia's formidable 100m freestyle relay in 2010 at the age of 18 and grabbed a Pan Pacifics silver and a gold at the Delhi Commonwealth Games later that year.
He was barely out of his teen years when he stormed to the individual world title in Shanghai and anchored Australia's relay gold with a lead-off swim of 47.49 seconds, smashing Dutch great Pieter van den Hoogenband's record in a non-synthetic suit.
Improving his time to 47.10 seconds at national Olympic trials, Magnussen headed to London with the world at his feet and Brazilian Cesar Cielo's synthetic suit world record of 46.91 in his sights.
"Brace yourselves," he warned his rivals during a television interview at the trials in Adelaide.
It was a throwaway comment but it would come back to haunt him at London, where he swam a surprisingly slow lead-off in the 100m relay. The vaunted Australian relay team finished fourth.
He swam faster in the individual event but left London with a silver and most of the blame for Australia's flop in the pool.
A scathing review commissioned by Swimming Australia later revealed Magnussen and his freestyle relay team mates had taken Stilnox, a sleeping medication banned by the Australian Olympic Committee, and had pestered other swimmers at a pre-Games camp.
Dubbed the "Stilnox Six", the swimmers said they had taken the medication as a "bonding" exercise and were forced to make a public apology.
Magnussen shrugged off the controversy to claim his second 100m world title in Barcelona in 2013 but was denied his bid for an unprecedented hat-trick in 2015 by shoulder surgery.
His hopes of Olympic redemption were also crushed when he placed fourth in the 2016 national trials but he helped the team to a bronze in the 100m relay at Rio, his third Olympic medal.
Despite three world championships and a slew of other medals, Magnussen's retirement may be met with regret from some swim fans, but Swimming Australia President John Bertrand said he should look back on his career with pride.
“He should be very proud of what he has achieved – very few people in the world have reached these heights in competitive sport," Bertrand said.
Editing by Andrew Both/Peter Rutherford