When the curtain was raised on the gymnastics competition at the London Olympics, reigning world champion Jordyn Wieber was expected to dominate, while her American teammate Gabby Douglas was pegged as a fast-rising dynamo to watch.

But 18-year-old Aly Raisman, who has trained and competed in their shadows these past years, seized the spotlight at North Greenwich Arena, winning gold Tuesday for the performance of her life in a technically demanding, inspired floor exercise.

Along with the bronze she claimed on balance beam earlier in the day, Raisman, the hard-working captain of the U.S. team, will leave London with the most glistening medal haul of any female gymnast at the 2012 Games, having won two golds and a bronze.

Douglas, 16, of Virginia Beach, dazzled like none other at the start, leading the United States to the team gold July 31 and returning two days later to win all-around gold, the sport’s biggest individual prize. But the global star that was minted overnight at the London Games, though a decade in the making, simply gave out.

With a chance to win a third and fourth Olympic medal, Douglas finished eighth on the uneven bars Monday and seventh on the balance beam Tuesday, taking a rare tumble from an apparatus she normally makes look as wide as a sidewalk.

“I’m a little bit disappointed in that performance,” Douglas said afterward. “I could have done a little bit better, but mentally and physically I was kind of tired.”

Douglas added that she was proud and happy about her two Olympic gold medals.

“I gave it my all,” she said with a smile. “Obviously it wasn’t my day to shine.”

Wieber, who turns 17 on Sunday, will return to Michigan with but one medal, the all-important U.S. team gold, when she had aspired to so much more. But her campaign to win an individual title in the only event she qualified for, the floor routine, ended with a seventh-place score — a devastating but fair mark for a performance in which the normally reliable Wieber stepped out of bounds and lacked her normal vigor.

Afterward she revealed she has been competing since the Games began with a stress fracture in her lower right leg. Nonetheless, Wieber delivered clutch routines that helped her squad become just the second to win Olympic team gold for the United States, replicating the feat of the so-called Magnificent Seven at the 1996 Atlanta Games.

For all its beauty, gymnastics exacts a harsh toll on still-developing teenagers. Even at 100 pounds, the human body simply isn’t designed to fly as high as Raisman and Wieber do on their explosive tumbling sequences. And it defies physics and common sense that Douglas, 94 pounds of muscle and elasticity, can reel off backward and forward somersaults on a balance beam that’s only four inches wide.

Years of work and sacrifice go into performing these routines over and over until they’re imprinted in muscle memory. But, as U.S. team coordinator Martha Karolyi noted Tuesday, the mental component of gymnasts can’t be programmed like a computer.

Pressure, anxiety, nerves — each has a say in the matter, too. In the case of Douglas, that’s what kept her from doing her best, according to Karolyi.

“I think it was overwhelming, winning the team and individual gold medal, which is the dream of any gymnast, and all the attention which was given to her — the ‘Today Show’ and media and everything,” Karolyi said. “She is a young girl. She wasn’t even in the limelight before. It was too much, too quickly. And she wasn’t able to focus the same after the all-around, unfortunately.”

Though Wieber’s leg has bothered her since trials in June, she has not undergone an MRI exam. John Geddert, Wieber’s coach, said that will happen once she’s home, where she is expected to be placed in a walking boot for six weeks. Missing the Olympics, Geddert said, simply wasn’t an option.

“It would have taken wild horses to drag her out of here,” Geddert said. “She’s not going to not compete. So I didn’t want to dwell on it; she didn’t want to dwell on it.”

Raisman, for her part, didn’t appear to get off to a triumphant start Tuesday. Competing last on the balance beam after several top contenders had wobbled wildly and toppled, Raisman held her nerves and form to deliver what appeared to be a medal-worthy routine. Judges scored it 14.966 points, which placed it fourth behind Romanian veteran Catalina Ponor, who was credited with bronze.

Raisman’s coach, Mihai Brestyan, promptly appealed the mark.

The score of a gymnastics routine is composed of two elements: one for its difficulty, another for its execution. Only the difficulty score can be appealed, and Brestyan argued that Raisman hadn’t been given full credit for one of the skills in her routine.

After a second panel of judges reviewed Raisman’s performance frame-by-frame on video and raised her score to 15.066, the exact mark Ponor was granted. But Raisman was granted bronze in a tiebreak by virtue of her higher execution marks.

Buoyed by the outcome, Raisman threw herself into her floor routine with unbridled confidence. She left judges no room to quibble over her placement, earning the highest marks for both difficulty (6.500) and execution (9.100).

Ponor took silver (15.200). And Russia’s Aliya Mustafina claimed bronze (14.900).

In the men’s horizontal bar final, Americans Danell Leyva and Jonathan Horton finished fifth and sixth, respectively, with scores of 15.833 and 15.466.