RIO DE JANEIRO (AP) — Kristina Vogel proudly watched the German flag rise to the rafters of the Olympic velodrome, her victory in the women's individual sprint a validation of all her hard work the past four years.

The fact that it was flanked by two British flags was hardly a surprise.

Vogel was just about the only track cyclist to stop Britain's gold rush at the Rio Games, beating Katy Marchant in the semifinals and Becky James in the finals. But the two British sprinters still swept the other two medals up for grabs, a sign of just how dominant their nation is in the sport.

Ten events yielded six gold medals, four silver medals and a bronze.

And left Vogel and dozens of other competitors wondering just how they do it.

"I don't say they took drugs or have engines in the bike," Vogel said. "But it seems they don't train for years and then at the Olympics they kill every nation."

In interviews with several British riders, the answer was always the same: massive investment of resources, hard work and the Olympics as their singular focus every four years.

Start with the finances at their disposal.

After an embarrassing showing at the 1996 Atlanta Games, where Team GB failed to win a single track cycling medal, the country began funneling proceeds from its national lottery into the program. Millions of dollars were invested in infrastructure and talent identification.

New velodromes and training centers were built. Stars were born.

Four years later, Britain won gold, silver and two bronze medals in Sydney. Four years after that came two gold medals in Athens. And by the 2008 Beijing Games, Britain was atop the table.

Its team won seven gold medals that year, seven more at the 2012 London Games and, when combined with the six won in Rio, has won 20 of the past 30 gold medals available at the Olympics.

"The lottery funding is a big part of it," said Jason Kenny, who won three gold medals in Rio to push his career total to six. "It allows us to focus entirely on winning medals."

The money also helps to fund the Secret Squirrel Club, named after the Hanna-Barbera cartoon from the 1960s, a group of scientists and high-performance experts who have turned out technological marvels that give Britain an edge. Among them are paints developed with F1 teams Mercedes, McLaren and Red Bull that allow bikes to slip through air quicker, skinsuits from adidas with specialized ribbing to improve efficiency, and aerodynamic helmets that are unlike anything worn by other teams.

Still, all that money and technology would be wasted if not for the talent.

Over the past two decades, Britain has built up its grassroots cycling program to give young and aspiring riders a chance to compete. Those who show the most promise graduate to different levels in the British system, from junior academies to senior academies to the "Olympic Podium Program."

The name itself tells you the value they place on the Summer Games.

By that point, athletes are full-time cyclists based at the national training center in Manchester, their day job essentially to train for the Olympics. Among those who have gone through the program are Kenny, his fiancee and four-time Olympic champion Laura Trott, and former Tour de France winner Bradley Wiggins, who returned to track cycling to win his fifth gold medal in Rio.

"I always thought how special London was. I went there without any expectations, so to win two golds was just incredible," Trott said, "and then I thought, 'How on earth am I going to top that?' We believe in ourselves and in our team. Everything here just snowballs."

The snowball hits its maximum speed every four years, and that's by design.

Britain routinely struggles at major events such as the world championships in intervening years, only to pop up and dominate the Olympics. One French coach mused they must bring out "magic wheels" every four years, and Vogel went so far as to call them "cannon fodder" at the world championships.

It only underscores the belief among some that there is something out-of-bounds going on.

"I don't know how they do it. I can't explain it," said Russian rider Denis Dmitriev. "They have a secret. Who knows what it is? But yeah, they're always best at the moment."

British pursuit star Joanna Rowsell-Shand said the point is to peak for the Olympics, not for the world championships or any other competition. Four years are spent sharpening themselves to a razor-fine edge, even if it means sometimes embarrassing results elsewhere.

"That's quite a hard thing to go to world championships and know you're not at your top form," she said. "Even at worlds this year, we knew there was more to come for the Olympics."

The resulting medal haul has left rivals feeling a mixture of awe and envy, often left to race for silver and bronze medals at the sporting event that means the most to them.

"I think they are doing it right," Vogel said. "I just want to know what they are doing."