This is an archived article and the information in the article may be outdated. Please look at the time stamp on the story to see when it was last updated.

Although the color of their medal wasn’t what they wanted, the mettle of the team came through in the end.

The United States salvaged a rocky tournament by winning bronze in women’s soccer at the Tokyo Olympics on Thursday. Megan Rapinoe and Carli Lloyd scored two goals each in a 4-3 win over Australia after opening the Tokyo Games with an uncharacteristic 3-0 loss to Sweden.

“It’s very satisfying. I think we all realized we didn’t play the best this entire tournament,” U.S. captain Becky Sauerbrunn said. “So to have the response that we did after a very disappointing semifinal, to show the USA mentality and the resiliency, to put the performance in that we wanted to be playing the entire time, and to finally find it in a game like that — very satisfying.”

The loss spoiled the Australians’ first-ever trip to the medal round at the Olympics. No Australian soccer team, men or women, has ever won a medal.

The Matildas were the underdogs against the United States, the top-ranked team in the world and the defending World Cup champions who came to Japan vying for gold. But the Americans struggled at times, including in a 1-0 loss to Canada in the semifinals. The Canadians hadn’t defeated their North American counterparts since 2001.

The U.S. team that came out against Australia looked completely different.

“That was the U.S. mentality,” Lloyd said. “We played well, we strung some really good sequences together, scored some great goals. And I’m extremely proud of the way we persevered, they way we turned things around. We’re going home with a medal, and there’s no greater feeling than that.”

Rapinoe scored directly from a corner kick in the eighth minute to give the Americans an early lead. It was the second time Rapinoe has scored an Olimpico, as goals from corners are known: She also had one in the semifinals of the 2012 Olympics against Canada.

Sam Kerr pulled the Australians even with a goal in the 17th minute that got past U.S. goalkeeper Adrianna Franch.

Franch got her first start in a major tournament in place of Alyssa Naeher, who injured her right knee in the U.S. team’s semifinal loss to Canada.

Just 27, Kerr became the all-time leading scorer for the Australians with 48 goals. She led all scorers remaining in the tournament with six goals.

Rapinoe’s second goal came on a stunning volley in the 21st, and it became obvious that the Australians were missing defender Ellie Carpenter, who was handed a red card late in the Matildas’ 1-0 semifinal loss to Sweden.

Lloyd made it 3-1 in first-half stoppage time when her left-footed shot got past Australia goalkeeper Teagan Micah. She added another on a break in the 51st minute, giving her a U.S. record 10 career Olympic goals. She is the first American woman to score in four Olympics.

Lloyd made her 312th appearance for the national team in the match, passing Christie Rampone for second on the all-time list. Kristine Lilly leads the career appearances list with 354.

Lloyd is 39 and likely playing in her last major tournament. When she was replaced in the 81st minute, teammates ran over to offer handshakes and high-fives, and the bench gave her a standing ovation.

Lloyd said afterward that she had not made a decision about her future just yet.

Caitlin Foord kept the Australians in the game with a goal in the 54th minute before Emily Gielnik scored to narrow it further in the 90th, but ultimately the Matildas couldn’t make up the difference.

Kerr sat alone on the field for a long time after the final whistle.

“Being so close and really taking it to one of the top teams in the world, and out-playing them at times and getting so close to scoring in certain moments, it just feels like we were right there and it’s been snatched from us,” Australia defender Steph Catley said. “It’s definitely tough to take.”

The Australians had already met the United States at the Tokyo Olympics, holding the Americans to a scoreless draw in the final game of the group stage. Australia was also the only team in the group to score on the Swedes, who are headed for the gold medal match Friday against Canada.

The U.S. team’s tournament-opening loss to to Sweden snapped a 44-match unbeaten streak. After a rebound victory over New Zealand came the scoreless draw with Australia. In the quarterfinals, the U.S. got past the Netherlands inn a penalty shootout.

But they were thwarted in a quest to become the first team to win an Olympics after a World Cup title by their Canadian rivals. Jessie Fleming scored on a penalty kick in the 74th minute for the game’s lone goal.

The players said Thursday they had a team meeting after the loss to Canada.

“It’s been in Ohio as early as the mid-1850s at least, brought in as an ornamental plant because of its unique foliage and white flowers,” Gardner said. “It was actually planted in people’s landscaping, and it has been spreading.”

“I felt like we just had a good vibe going into the game. We’ve done, as you can imagine, lots of talking and meetings and hashing it all out and doing the autopsy,” Rapinoe said. “But I felt like we just got to a good place.”

The United States has reached the gold medal match at the Olympics five times. The Americans have four gold medals, more than any other team since women’s soccer became an Olympic sport in 1996.

But it is the second Olympics they have failed to reach the gold medal match. They were beaten by Sweden in the quarterfinals five years ago in Brazil.