– By the time Jessie Diggins got rolling on the anchor leg of her race Saturday, her American team already was out of the chase for an Olympic medal in cross-country skiing. Still, she was battling a skier from Italy for eighth place in the women’s 4x5-kilometer relay, hoping to move up one spot from where she started.

Diggins surged hard and passed the Italian. Then, when the Afton native sprinted into the stadium at Laura Cross-Country and Biathlon Centre, she skied into the wrong lane and had to turn around. It was that kind of day for the U.S. team, which finished in ninth place after a slow opening leg by Kikkan Randall put it into an early hole.

The relay was viewed as perhaps the best remaining chance for the American women to win their first Olympic medal ever in cross-country. Instead, they were left to analyze what went wrong — and to try to figure it out before their final two Olympic events.

Sweden sprang a huge upset, winning the relay for its first gold of the Sochi Games as heavily favored Norway finished fifth. Anchor Charlotte Kalla won a thrilling sprint at the finish with the fastest leg of the day, making up a 25.7-second deficit. The Swedes finished in 53 minutes, 2.7 seconds, with Finland second and Germany third.

“Going into the stadium, I was nearly blacked out, and I just took the wrong lane,’’ said Diggins, who skied her leg in 13:32.2, eighth-fastest among the anchors. “I went into the lap lane and had to turn around, so I lost us a spot that way. It was a dumb mistake that happens sometimes.

“I’m really proud of how I skied. I pushed myself really hard. We pushed ourselves as hard as we could, and we believed in each other, and that’s what matters. I’m just really proud of the team effort.’’

The Americans finished in 55:33.4, more than 2½ minutes behind Sweden. The race was over almost as quickly as it started, as Randall faltered badly on the opening leg and finished in 12th place.

Randall started strongly, then faded when the lead group accelerated. It was the latest perplexing performance from the best female cross-country skier in U.S. history. Randall, favored to medal in the freestyle sprint, weakened in the late stages of the quarterfinals of that race and did not advance.

U.S. coach Matt Whitcomb said Randall is not ill or injured, and Randall said there were no issues with the course conditions or her skis. Saturday, she was at a loss to explain what had happened.

“I felt totally ready coming into today,’’ she said. “I have some work to do to figure out what’s going on.

“I looked forward to being in the hunt today. It’s tough to feel that already start to slip away on the first leg. I tried to get it back, but I just couldn’t find that gear again.’’

The U.S. had won two World Cup bronze medals in the relay in the past two years, raising hopes for an Olympic score. Decked out in their striped socks, face paint and glitter supplied by Diggins, all four women said they were as well-prepared as they could have been.

Randall finished the opening leg 39.7 seconds behind the leader. Sadie Bjornsen moved them up to ninth place in the second leg, and Liz Stephen and Diggins could get them no closer.

All of the women remained upbeat afterward, insisting they will not define their experience by whether they win a medal. Whitcomb said the team’s resolve and attitude remain strong. He has two sports psychologists at his disposal, but he said he has rarely used them because the U.S. women are so supportive of one another.

“We talked last night about doing three things,’’ he said. “One was never say die, fight until the end. Another was believe in your teammates and believe in yourself. And the third was, ‘Get your sparkle on.’

“When my eyes welled up at the end of the day, it’s because we executed that. We talked about when we nail those three points, any result is going to be good for us. We’re not broken. We’re as strong as we’ve ever been. We just didn’t ski fast enough.’’

Norway, the defending Olympic champion in the relay, had not lost in that event in the 10 World Cup races it had entered since the Vancouver Games. Kalla became the first athlete to win three golds in Sochi.