RIO DE JANEIRO — Undefeated, uncatchable, unquestionably the best.

Usain Bolt bid a blazing-fast farewell to the Rio de Janeiro Olympics, and probably the Olympics altogether, Friday night with yet another anchor leg for the ages. He turned a close 4×100 relay race against Japan and the United States into a runaway, helping Jamaica cross the line in 37.27 seconds.

With the victory, Bolt won his ninth career Olympic medal and completed a triple-triple, with three gold medals at three consecutive Olympics.

“There you go,” Bolt said. “I’m the greatest.”

The U.S. finished the race third but endured yet another relay debacle — the Americans were disqualified because it was ruled that leadoff runner Mike Rodgers passed the baton to Justin Gatlin outside the exchange zone. Canada was elevated to the bronze-medal position in a national-record 37.64 seconds, trailing silver medalist Japan.

USA Track & Field said early Saturday morning that it had appealed the decision.

It marked the ninth time since 1995 the U.S. men have been disqualified or failed to get the baton around at the Olympics or world championships.

“Hell, we already did the victory lap, and then when we talked to TV, they told us,” said Tyson Gay, who ran the third leg for the Americans. “They said Justin got the stick before the zone. He’s saying he didn’t. Hopefully we can appeal.”

Gatlin called the incident “a twilight zone, a nightmare — all that hard work just crumbles.”

“I believe in my guys, man,” he said. “I just hate that it happened to us in this fashion.”

Japan, which had the lead going into the last baton change, finished .33 seconds behind Jamaica.

Undaunted despite running in the lane beside Bolt, Aska Cambridge anchored Japan in an Asian record time of 37.60.

It topped the bronze medal from the team of 2008 — the first men from Japan to win an Olympic track medal in a sprinting event.

“It was really, really fantastic and it’s just so nice to be part of it,” said the 23-year-old Cambridge, who has a Japanese mother and a Jamaican father. “I may have Jamaican blood, but I was brought up in Japan, and trained in Japan.

Canada’s Andre de Grasse, who won silver in the 200 meters and bronze in the 100, said his team had seen the Americans disqualified before, most recently at last year’s world championships.

“Last year we were fourth, and U.S. got DQ’d and we got a medal,” he said. “I told them all to wait around, you don’t know what can happen. It’s tricky — sometimes it just doesn’t take just speed.”

Still, he hadn’t been expecting such big things from the silver medalists.

“Japan probably surprised us a little bit,” de Grasse said. “We didn’t expect to see them up there. But congrats to them as well.”

Gatlin has won five medals in his career, including a gold in the 100 meters at the 2004 Athens Games. At age 34, he said he wasn’t willing to call this the end of his Olympic career.

“I never said this was my last Olympics,” he said. “This has made me hungry for the world championships next year.”

Bolt hasn’t botched a relay handoff in any major championship since he started running them in 2007. It’s easier when you know you’re the fastest man out there.

Bolt’s record in Olympic finals: nine races, nine wins. Nobody has done that before, and nobody’s on the horizon to do it again soon.

As expected, Bolt said he doesn’t plan to compete again in the Olympics.

“I’m sorry guys,” said Bolt, who has a vacation on tap next. “But this is the last one.”

Along with Bolt for his final trip down the track were Nickel Ashmeade, training partner Yohan Blake and the Jamaican elder statesman, former world-record holder Asafa Powell.

“My team came through for me tonight,” Bolt said. “As long as we got the baton round, it was never in doubt.”

When Bolt received the yellow baton from Ashmeade for his final run down the straightaway, he was even, maybe a step behind, Japan’s Cambridge and Trayvon Bromell of the United States.

That lasted about four steps.

With 70 meters to go, it was all over. He looked at the clock, same as he did when he finished the 200-meter victory the night before. No world record, but he still owns that one, too — 36.84 seconds, set four years ago at the London Games.

“I am just relieved,” Bolt said. “It’s happened. I am just happy, proud of myself. It’s come true. The pressure is real. I look at it as an accomplishment.”

Counting all the preliminaries, finals and his approximately nine-second blast down the stretch in Friday’s last race, Bolt has spent 325 seconds, a tad less than 5 1/2 minutes, running on the track at the Olympics since he made his debut in Beijing eight years ago.

Every tick of the clock has been a treasure. And while he might not close things out with 23 golds, the number Michael Phelps left Rio with earlier this week, it’s hard to argue there is anybody more successful or electric or important to his sport and the Olympics themselves.

The anchor sport of the Olympics has been mired, especially over the past year, in a cesspool of doping, cheating and bad characters.

When Bolt’s on the track, everyone forgets.

“A great sprinter,” said Gay, who once upon a time was Bolt’s biggest challenger. “Nine gold medals, words can’t even describe what he’s done for the sport.”

So much of that is because the show isn’t over when he’s through running. After crossing the line for his finale, Bolt pumped his fist in the air, slowed down and took off those famous gold spikes. He huddled with his teammates, and they prayed. Then, a final, luxurious ring around the track.

“I’ll stay up late tonight,” Bolt said when asked how he’d celebrate.

But before he left the track, his partners peeled off from the victory lap. With the stadium emptying, Bolt kneeled down, brought his hands out to his sides and soaked in one last burst of applause. Then, he kissed the track and slapped his hand on the number “3” painted at the starting line.

As in three Olympics, three races at each, three gold medals each time.

He could have just as easily slapped the number “1.” That would need no explanation.

Bolt celebrated by returning to a darkened Olympic Stadium, surrounded by volunteers — and throwing a javelin.

Really.

After his news conference ended in the wee hours, Bolt came back onto the track with most of the lights in the stadium having already been turned off.

Bolt took a couple throws of the javelin, the last one going about 50 meters.

He posed for some pictures afterward, with the javelin — which he requested a formal measurement of — still stuck in the Olympic Stadium turf.

Bolt’s final throw would have earned him a sixth-place finish at this year’s Jamaican national championships.

Information from The Associated Press was used in this report.