Paul Myerberg

USA TODAY Sports

RIO DE JANEIRO — First Paul Chelimo won silver. Then, he didn't. Then Bernard Lagat won bronze. And then, in turn, he didn't.

And then, in a final twist, Chelimo did indeed win silver — returning to his place on the medal podium amid a strange scene on the final night of track and field competition at the Rio Games.

The men's 5,000 meters ended with Chelimo in silver, behind Great Britain's Mo Farah and ahead of Ethiopia's Hagos Gebrhiwhet.

Minutes after the race was completed, however, a number of runners were disqualified for breaking IAAF rule 163.3 (b), which states that "an athlete running on a bend ... shall not step or run on or inside the (line) marking the applicable border."

Included in the disqualification were Chelimo, Canada's Mohammed Ahmed and Ethiopia's Muktar Edris. That moved Lagat from sixth into bronze, temporarily giving the 41-year-old Olympian his third career medal in his fifth Summer Games.

Matt Centrowitz wins first U.S. gold in men's 1,500 since 1908

It took more than an hour to sort out the final ruling. Interviewed after the race by NBC — which informed Chelimo he was disqualified on live television — Chelimo said he would appeal the decision.

The appeal put forth by USA Track and Field was successful, putting Gebrhiwhet back into bronze and knocking Lagat off the medal podium.

"I don't really know what happened but I am happy to be back in it and I'm happy to call myself the 5000m Olympic silver medallist," Chelimo said.

Chelimo's silver is the first medal for the USA in the event since 1964.

A two-time medalist running for Kenya , where he was born, Lagat became a naturalized citizen of the USA in 2004 and represented the country in each of the past three Summer Games.

"To disqualify people when they didn't gain an advantage is not the right spirit," Lagat said. "I like to know I earned my medal."

Lagat’s last medal came a dozen years ago at the 2004 Athens Games.

TRACK AND FIELD AT THE RIO OLYMPICS