Last updated on .From the section Olympics

Singapore's Joseph Schooling won his nation's first ever Olympic gold medal with victory in the 100m butterfly as Michael Phelps was one of three men to finish joint second.

Schooling, 21, won in an Olympic record time of 50.39 seconds.

The Singaporean was always in control and won by 0.75 seconds from the trio of Phelps, South Africa's Chad le Clos and Hungary's Laszlo Cseh.

Phelps, 31, could win his 23rd gold in the 4x100m medley relay on Saturday.

The American was not part of his country's team that qualified for the final having taken the afternoon off after winning his 22nd gold in the 200m individual medley on Thursday.

Phelps, who was denied a fourth successive gold in the 100m butterfly by Schooling, will end his Olympic career by competing in the final race in the Rio pool.

"This is it. I'm not doing it. I swore in London I wasn't coming back but this is final," he said.

Schooling said of his win: "I'm just ecstatic. I don't think it has set in yet. It's just crazy.

"I hope that Michael can stay around long enough for me to race him again. I'd love that."