LONDON (AP) — Aly Raisman was ready to claim her Olympic legacy. She just needed a little bit of karmic justice to help her do it.

Some quick thinking from Martha and Bela Karolyi helped, too.

The ever-steady, ever-stoic captain of the U.S. women's Olympic gymnastics team made history during the event finals on Tuesday, becoming the first American to win gold on floor exercise. She added a bronze on balance beam to cap off an already impressive two-week run.

Not bad for the athlete who's the often overlooked core of the superstar group of U.S. gymnasts known as the "Fierce Five."

Five days after a tiebreaker cost her bronze in the all-around, Raisman won a tiebreaker to reach the podium on beam and turned the confidence boost into what she called the best floor routine of her life.

"Wow!" she yelled after finishing four flawless tumbling runs over 90 nearly flawless seconds. Then she raced to hug coach Mihai Brestyan.

He reminded her to enjoy the moment.

"I told her, 'That's the maximum you can get, now just wait for the color,'" Brestyan said.

It was gold. A sparkly bookend to the gold she helped the U.S. grab in the team finals last week.

The victory gave Raisman three medals for the meet. One more than all-around champion Gabby Douglas. Two more than good friend and world champion Jordyn Wieber.

This from a gymnast who has spent most of her career being too reliable for her own good. The 18-year-old lacks the bubbly star quality of Douglas or the driven intensity of Wieber.

What she does have, however, is power to spare and a "team-first" mentality that filtered down through the ranks.

"It looked like Aly always did the best for the team then when it came to do stuff for Aly Raisman, I don't know, she could not deliver her best," U.S. women's team coordinator Martha Karolyi said.

Until the last day of perhaps the last major meet of her career. Raisman — who lost a tiebreaker to Russia's Aliya Mustafina in the all-around finals that prevented her from joining Douglas on the podium — appeared headed for a similar fate Tuesday when her beam score of 14.966 flashed on the screen.

That was lower than what she normally scores, but Brestyan was resigned to it until the Karolyis, sitting a few rows above, screamed at him to appeal. As the national team coordinator, every medal — or almost medal — matters as much to Martha Karolyi as the gymnasts.

"(Brestyan) didn't want to do it because normally it doesn't work out in my favor," Raisman said. "This time, it did."

After a quick review, the judges bumped Raisman's difficulty score to a 6.3, pushing her into a tie with Romania's Catalina Ponor at 15.066. Raisman earned the medal for executing just a little bit better.

Wieber and Douglas struggled following a draining 10 days, though for very different reasons. Wieber came in looking to win a handful of medals but ended up with just one — the team gold — after failing to qualify for the all-around finals and finishing seventh on floor.

She flew out of bounds early during her first competitive event in a week and didn't come close to reaching the medal stand. Afterward coach John Geddert revealed she was dealing with a painful right leg injury that limited her training.

When Wieber flies home to Michigan after the games, she'll do it wearing a walking boot to protect and ready for X-rays that Geddert expects to reveal a stress fracture.

While Wieber insists her leg is "fine," Geddert is positive the pain and watered-down practices took its toll.

"I know you're at the Olympic games, you've got to deal with what you've got to deal with," Geddert said. "The fact that we couldn't train normally, obviously there were very few performances that were polished and we've got to be polished here."

It's a polish Douglas had in abundance in becoming the first African-American to win the Olympic all-around title. The subsequent hoopla left her drained for event finals. She was last on uneven bars on Monday and 24 hours later was a non-factor in the beam final after an uncharacteristic fall.

"If it wasn't my time to shine, it wasn't my time to shine," Douglas said. "Overall I think the competition went really well. I wanted to finish off on a good note. Event finals is something a little extra."

The U.S. finished with six medals in all, a solid number but four less than the 2008 team captured. Not that it matters, not after the group of teenagers stormed to victory in the team competition to give the Americans their first Olympic title in 16 years.

"I feel it was extremely successful," Karolyi said. "It showed the power of this young generation and showed the mental toughness of this whole team. I can't wish for anything more."

The men certainly could. The group that made its motto "One Team, One Dream" ended up walking away with just one medal, the bronze earned by Danell Leyva in the all-around.

Leyva and teammate Jon Horton put together solid sets in the high bar final on Tuesday, but finished well behind gold medalist Epke Zonderland of The Netherlands, whose jaw-dropping score of 16.533 after a breathtaking display left Horton — who had to go next — laughing.

"He makes my routine not so cool anymore," Horton said.

Expect Horton to work on that. The 26-year-old team captain plans to work toward the 2016 games in Rio de Janeiro. He expects teammates Leyva, Sam Mikulak, John Orozco and Jake Dalton — all 21 or younger — to stick around too.

There's more uncertainty surrounding one of the most decorated U.S. women's teams of all time. While 15-year-old Kyla Ross and 16-year-olds Douglas and McKayla Maroney could compete for awhile, the future is a bit cloudier for Raisman and Wieber.

Wieber begins her senior year of high school in the fall, and Raisman has already graduated. They both plan to stay in training, but projecting four months down the road — much less four years — is difficult.

Karolyi believes all five team members can continue to compete if they stay healthy but will understand if they don't. They've already reached the top for their sport. Anything else is just gravy.