TOKYO — Years of preparation had led to this summer when, finally, a two-week stretch of Olympic competition gave Simone Biles, the biggest star of her sport, a massive opportunity to shine. She could earn another hefty batch of her sport’s most prized medals, with the expectation that many of them would be gold. She hoped to introduce a new, wildly difficult skill to women’s gymnastics. She planned to show the world how she somehow managed to become even better than the version of herself that dominated the Rio de Janeiro Games five years ago.

But there she stood Tuesday, facing the beam alone, and none of that mattered — not the medals, the records, the expectations or the result. After withdrawing from all of the previous medal competitions because her mental well-being plunged to an extent that she no longer felt safe performing, Biles returned in time for the balance beam final, and that became her triumph of these Games.

“I could see in her eyes that she wanted to do it,” said Biles’s coach, Cecile Landi.

And Biles felt ready. So she hugged Landi, then mounted the beam, delivering not her best or most difficult performance but one that showcased poise in a stressful moment. She earned a 14.000, enough for the bronze medal — the seventh Olympic medal of her career and one that represents a moment of pride at the end of a whirlwind trip to Tokyo.

“The pressure was there,” Biles said, “but I was doing it more for myself.”

After Biles nailed her dismount with just a hop on the landing, she embraced her coach again and then U.S. teammate Sunisa Lee, who placed fifth. Biles waved to the crowd, her time at these Games complete, and then jumped up and down when she noticed a stranger in the stands brought cutout pictures of her dogs. The arena, filled with Olympic officials and members of each country’s delegation, watched Biles’s skills in silence. They responded with cheers when she completed each element, then returned to a hush as the next trick awaited.

Simone Biles won bronze on balance beam after returning to the Tokyo Olympics on Aug. 3 following her withdrawal from several of the main competitions. (AP)

Biles navigated every moment with composure, even though she said she didn’t enter this competition expecting a medal. She was just glad to have another chance to perform at the Olympics. Afterward, she waited for the other finalists to compete, and multiple gymnasts, including Lee, made significant mistakes that kept Biles in medal contention. Guan Chenchen, a 16-year-old from China, entered the final as the gold medal favorite. As the last gymnast to perform, Guan’s precise routine received a gold medal-winning 14.633. China’s Tang Xijing executed an excellent routine earlier in the lineup and earned a 14.233 for the silver.

Biles’s usual level of difficulty would have pushed her toward those marks. But to compete safely in Tuesday’s final, she had to tweak her dismount to a simpler skill, a double pike, which she said she doesn’t think she had performed since she was 12 years old. Landi reminded her beforehand to make sure she prepared for the landing so she wouldn’t fly backward with too much power.

Once Biles finished her routine, she seemed joyous and relieved, but this medal — even though she said it feels “sweeter” than the bronze she earned on beam in 2016 — doesn’t erase the underlying struggle that made these Games so challenging.

“I don’t really know how I’m feeling,” Biles said. “Right now, I just feel like I have to go home and work on myself and be okay with what’s happened.”

Biles has dominated this sport for nearly a decade, winning four gold medals in Rio and 25 medals at world championships through the years, but during last week’s team final competition, she finally appeared human. The emotional toll of years of competing with these immense expectations became too much.

Biles wanted this Olympics to be about herself — her own joy and only the expectations that came from within. But she began the competition still feeling pressure from the rest of the world as it marveled at her transcendent ability and assumed she had never wavered from those heights no gymnast had ever reached. For years, Biles never did.

And then she stalled while suspended in the air during a vault and couldn’t finish the team competition. The partnership between her mind and body that has served her well for all this time suddenly disconnected. She felt lost. Past achievements meant nothing.

“That’s what I couldn’t wrap my head around,” Biles said. “What happened? Was I overtired? Where did the wires not connect? And that was really hard because I trained my whole life. I was physically ready.”

After the qualifying round, Biles and her teammates returned to training, and her problems began. The gymnasts from the Russian Olympic Committee finished ahead of the usually dominant U.S. team, and “there was a sense of everybody freaking out, except for us,” Biles said. The gymnasts were initially supposed to have that morning off, Biles said, but they practiced instead. Once they started tumbling, she said, “that’s when the wires just snapped.” Another day she couldn’t finish a practice after having a mental breakdown before bars.

Biles experienced a dangerous phenomenon known in gymnastics as “the twisties” that ultimately derailed her run through the Olympics. She attended every previous session of the competition — cheering from the stands as Lee won the all-around title and Americans stood on the podium after each apparatus final — but she couldn’t take part.

Still, when she watches athletes perform a double-twisting double tuck, “I cannot fathom how they’re doing it,” she said. That’s a skill she usually executes with ease, but with her mind and body out of sync, the idea of flying through the air while twisting and flipping feels foreign.

After a week away from the competition floor, Biles’s routine proved to be plenty, even with the simpler dismount — not for the gold that had long been the standard but for a medal that will carry a distinct sense of worth.

“I just did this for me,” she said, “and me only.”