The United States’ attempt to become the first reigning women’s World Cup champion to win the following Olympic gold medal was derailed Monday by one of its oldest rivals.

Canada edged the Americans, 1-0, in the semifinals with a 74th-minute penalty kick and a stout defense that withstood being outshot, 13-3. The U.S.’ first loss to Canada in 20 years consigned the Americans to the bronze medal game, where they will face Australia on Thursday at 4 a.m. Eastern (USA Network).

The Americans started this game brightly, but the game took a dramatic turn in the 20th minute when goalkeeper Alyssa Naeher collided in the air with teammate Julie Ertz and injured her right knee coming down.

After a lengthy delay, the Penn State product initially stayed in the game. But the pain returned a few minutes later when Naeher took a goal kick, and in the 30th minute she had to exit. Backup Adrianna Franch replaced her.

Franch is a terrific goalkeeper for the NWSL’s Portland Thorns, but this was her first major tournament game. Her teammates made sure she had little work to do: She didn’t have a consequential touch until the fifth minute of six in first-half stoppage time.

There were just five shots taken between the teams in the first half, four by the U.S. and one by Canada. None were on target. That wasn’t too surprising, given the history of cagey games between the teams. But nor was it consolation for fans in both countries who woke up for the 4 a.m. Eastern time kickoff.

The U.S. slowly cranked up the pressure early in the second half, and in the 60th minute manager Vlatko Andonovski decided to turn the dial. He swapped out the entire front three at once: Christen Press, Carli Lloyd and Megan Rapinoe replaced Lynn Williams, Alex Morgan and Tobin Heath.

Canada manager Bev Priestman called for a double substitution in midfield at the same time. Off went Quinn and Nichelle Prince, who up to then had been arguably Canada’s best player; on came Julia Grosso and Deanne Rose.

Lloyd soon delivered the Americans’ first shot on target, forcing Stephanie Labbé to make a diving save in the 65th.

Now the play was almost all in the U.S.’ favor. Ertz thumped a header on frame in the 67th that Labbé pushed over her crossbar. Lindsey Horan forced a save with a header off the ensuing corner. At the 70th minute, the Americans had 11 shots to Canada’s one.

But the momentum swung in a second in the 72nd, when Tierna Davidson fouled Rose on the edge of the U.S.’ 18-yard box. After a video review confirmed the contact, referee Kateryna Monzul awarded a penalty kick.

Sinclair, Canada’s all-time star, handed the ball to 23-year-old Jessie Fleming. She stepped up and buried her attempt past a diving Franch, who guessed right but had no chance to stop the shot.

Andonovski sent in Sam Mewis for Kelley O’Hara with 10 minutes to go, switching the Americans’ formation to a 3-4-3. But the equalizer never came. Lloyd came closest, hitting the crossbar with a header off a Rapinoe cross in the 86th.

The last hope came on a 93rd-minute corner. Franch came up to be an extra attacker, Rapinoe sent it in, and Canada cleared it out. There was no miracle like there was in 2012, when the U.S. came from behind to stun Canada in the semifinals.

This time, there was joy for Canada, and a trip to Thursday’s gold medal game (10 p.m., USA Network) after winning bronze in 2012 and 2016. The Canucks will face Sweden, which confirmed its status as the tournament’s best team with a 1-0 win over Australia.

And for the United States, there was disappointment. Among the last images on the TV broadcast was Lloyd kneeling on the field in tears, likely knowing her last shot at an international title was gone.

For her, Rapinoe, and lots of other players in this game, it was more than a loss. It was the end of an era.

“We’ve been in this a long time together,” Rapinoe told NBC, noting as she fought back tears that she and Lloyd are “both closer to the end than the beginning, and we’ve shared a lot of those happy moments on the field — and, you know, not that many sad moments, but we’ve had a few.

“Obviously we want to send everybody out on the happiest note, and we weren’t able to do that today,” Rapinoe added.