RIO DE JANEIRO — Fiji and New Zealand had been hoping to play off for the gold medal in rugby’s return to the Olympics.

Instead, they’ll meet in the quarterfinals after a tumultuous group stage left playoff places hinging on the last group match between world series champion Fiji and the United States. The Americans needed a win, a draw or a loss by fewer than five points against Fiji on Wednesday to reach the quarterfinals at the expense of New Zealand, but missed out by one kick.

advertisement | advertise on newsday

Japan was the unlikely quarterfinalist in the mix, but has shown they can beat any team after a stunning 14-12 win over 12-time world series champion New Zealand to open the tournament. The Japanese followed it up with a 21-19 loss to Britain, missing a late kick to draw that match, and an impressive 31-7 victory over Kenya to set up a playoff against France — just one win away from the medal round.

Britain topped Pool C, scoring three first-half tries and then conceding three in the second in a 21-19 win over New Zealand, and will meet Argentina in the knockout round. That loss for New Zealand, their second at the tournament, left the pre-tournament medal favorites relying on Fiji to beat the Americans.

The Fijians conceded the first try when Danny Barrett stepped inside a defender and touched down near the posts for the Americans.

Fiji captain Osea Kolinisau finished off a long-range try, started from turnover ball deep inside Fiji’s half, to equalize but was then yellow-carded for tackling a player in the air just before halftime. Despite giving up a one-man advantage, the Fijians still managed to score before the break, and added two more in the second half. Perry Baker’s speed led directly to the second try for the Americans, keeping them in range until Ebner’s last-minute try set up the big finish.

advertisement | advertise on newsday

Australia beat Pool B winner South Africa 12-5 to move through as one of the two best third-place finishers, meaning those two countries will meet again later Wednesday in the quarterfinals.