A man in his 40s called Graham was cycling up a mountain in Mallorca this spring when he heard a strange whirring noise. It became immediately clear what it was when another rider breezed past, apparently without much effort. She had a tiny, performance-enhancing motor hidden in the frame of her bike. “I was livid!” Graham recalls. “She might as well have been riding a moped.”

The amateur cyclist wasn’t cheating because she wasn’t racing, but, in a small way, she was part of a growing problem. Because, while it is harder for professionals to dope and get away with it, amateurs at all levels of sport appear to be redrawing the line between the fair and the dishonest - or just motoring right across it.

“Right now, I imagine there are a lot of cyclists out there Googling ‘motor doping’ and thinking about doing it,” says Peter Flax, a racer and journalist in Los Angeles who has investigated cheating in amateur cycling. “There are lots of totally honest amateur racers devoted to doing it right, but there are enough out there who have other ideas.”

Doping used to be a much simpler problem. Drugs such as EPO (erythropoietin), the red-blood-cell-stimulating hormone once favoured by Lance Armstrong, were the preserve of the pros. But, in the past few years, amateur racers chasing much smaller prizes have begun testing positive for a range of substances. The problem is reportedly rife in amateur rugby and boxing, and cycling’s Independent Reform Commission (CIRC), says amateur doping is “endemic” in the sport.

Now, concealed motors are beginning to turn up in races, opening a second frontier in cheating. In April, Belgian cyclo-cross racer Femke van den Driessche was banned for six years after one of the devices, which are legal outside of racing but offer any cyclist a decisive advantage, was discovered in her bike during a world championships event in January.

Away from the drugs and the battery acid, there is a third frontier, where everyday athletes find subtler ways to massage performance and results in the age where exercise has become yet another thing to share online. “There’s an increased emphasis on looking fast than in actually being fast,” says Michael Hutchinson, the cycling writer and former Great Britain racing cyclist. “It’s sport as a public challenge rather than a private challenge.”

Hutchinson and others involved in sport at various levels describe how social media has combined with disposable incomes, vanity and the dirty example of the Armstrong era to create a new normal for many amateurs. But what motivates the no-name cheats among us? And where should we draw the line when we chase not riches and hero status, but arbitrary goals and bragging rights?

Now, anyone can hop on Google and get the same advice a team doctor used to get paid massive money for David Millar

David Millar, the retired British professional road-racing cyclist, who became an anti-doping advocate when he returned from a two-year ban for doping a decade ago, says that without more research, “everything is hearsay”. But he accepts that the landscape has changed. “In the old days, you had to find out how to do it underground,” he says from his home in Spain. “Now anyone can hop on Google and get the same advice a team doctor used to get paid massive money for.”

Not only advice, but the drugs themselves. A BBC Panorama investigation showed last year how easy it can be to buy EPO. Reporter Mark Daly became a transformed athlete on the drug. In one of the most depressing known cases of amateur doping, talented junior national time trial champion Gabriel Evans was caught taking the endurance-boosting drug last December. He said that the documentary had fuelled his curiosity.

The internet has opened a door to drugs, but it is changing the way we exercise in other ways, as our inclination to share achievements increases the pressure to make them shine. The medium of choice for cyclists and runners is Strava. When you upload an activity to the fitness social network, recorded on a phone, fitness tracker or cycling computer, it lays your route over a map and automatically ranks your time along identified “segments” of road. The fastest rider on each segment is named King or Queen of the Mountain (KOM/QOM), in a nod to the Tour de France.

Strava says that more than 150,000 people are signing up each week and that “tens of millions” of users upload almost half a million activities every day. As the network has grown, it has made racers of us all. If you see a lone cyclist gurning up a hill with a face like Chris Froome’s during an Alpine stage of Le Tour, or a runner dipping for an invisible finish line in the park, she’s probably trying to beat – and then upload – her personal best.

Hutchinson, a former national champion and Commonwealth Games veteran, has nothing to prove. But even he admits to getting sucked in. “There’s a 2.5-mile segment between two villages near me, which I’ve decided I’m getting before the end of summer,” he says from his home near Cambridge. “I’ll wait for the right breeze and I’ll be out in every bit of go-faster kit I own. I don’t confuse it with a proper bike race, but it’s still a competition. I look at it and think, I’d like to have that.”

Hutchinson runs, too, and has noticed suspicious activity on Strava. “You look at some runs and know the guy didn’t do it, because if he did he’d win the London Marathon,” he says. It’s easy to cheat accidentally. I’ve been guilty of ‘train doping’, when I left my bike computer running on the way home from a ride. I declared my 80mph top speed, but there is nothing to stop me driving my car up a hill at a not impossible but KOM-worthy speed with my device running. “You have to accept it’s a bit like the wild west,” Hutchinson says.

Yet runners and riders take Strava ridiculously seriously. The Los Angeles biking scene is abuzz with news of a mystery cyclist called Thorfinn-Saasquatch. Last summer, Peter Flax was riding up Mandeville Canyon, a highly contested climb north of Santa Monica, when a man swept past in a blur. “He was going up a huge hill like a pro and I was like: ‘Wow, who is that guy?’” Flax recalls. After weeks of detective work, he exposed the serial “KOM bagger” as Nicholas Brandt-Sorenson, an amateur racer who has failed a doping test and pleaded guilty to selling EPO to other amateurs. Strava says that users should flag suspicious segments, and that it encourages good sportsmanship under its “Stand With Us” code. At the time of writing, Thorfinn-Saasquatch remains top of the Mandeville Canyon leaderboard. He didn’t reply to emails, so you can only guess at his motivations. But his profile fits that of the wealthy, macho man of a certain age, a demographic singled out for concern in the CIRC report on amateur doping.

I’ve seen times that just don’t compute. If they were able to do that level clean, they would be on the world tour Chris Pook

“You go to a high-level masters race in California and it’s just shocking how much is being spent,” says Flax, who has seen racers increasingly employ pro trappings, including coaches, soigneurs (assistants) and spare bikes. “But we’re talking about people in their 40s and 50s racing for something that’s not even a state championship.” Flax suggests that these men are used to winning in life, and have become rich. They then compete to equip their custom frames with the most expensive parts (you can buy a pair of titanium pedals for £600). They spend 20 hours a week in training and want a return on their investment, whatever it costs.

If we were in the age of the Mamil (middle-aged man in Lycra), we are now rolling at incredible speed into the age of the super-Mamil. And if they’re not racing, they are taking part in “sportives” and “gran fondos”, the mass-participation marathons of the sport. These events, some of which cover multiple days, are timed. and can offer the intoxicating sense of being in a race. A few years ago, I took part in the Alpine Challenge, a four-day event in France with about 150 other riders. It wasn’t a race, but a leader’s jersey was awarded each evening, and riders in the fastest group analysed the leaderboard at breakfast as if it really mattered. I fell for it, too, and while I have no reason to suspect anyone was on anything other than pasta and energy bars, I could see how the illusion of professionalism and high stakes might lead the super-Mamil astray.

Gabriel Evans, banned for taking EPO after having his curiosity piqued by Panorama.

“I’ve seen climbers putting in performances that just don’t compute,” says Chris Pook, a talented amateur who has ridden in dozens of these events. “Because, if they were able to do that level clean, they would be hanging tough with the big boys on the world tour. But then they wouldn’t want that level of scrutiny.” Pook says that, apart from anything, he’s too terrified of needles to consider cheating. But he recognises the route of the amateur doper. “You spend the first few years as an enthusiast, making big gains,” he explains. “Then you enter some races and see enough tangible improvement to satisfy the majority of people with a competitive instinct. But later, when you can only commit 10 hours a week because you’ve got a job and a family, you get tired of not quite having enough. That’s when you get people who are morally weak thinking: ‘Well, actually, if I just tried this …’”

“It can become a slippery slope,” says Emily Palmer, a psychiatrist and amateur racer in Glasgow, who was talent-spotted by her spinning class instructor. Palmer takes caffeine supplements and beetroot juice, which give legal boosts. Her coach is Kevin Henderson, who also worked with Mark Daly, the Panorama reporter. Henderson says that, now cyclists pretend to train and ride like pros, they also use gyms in a way they never used to. Gym culture, he adds, and its traditional fondness for pharmaceuticals, is helping to lead athletes on to substances that, unlike beetroot juice, we have decided to ban. “They’re coming into contact with the bodybuilders, and we’re seeing amateur cyclists being done for steroid abuse,” he says.

If not the gym, where drugs can be attractive to the vain as much as the potentially victorious, Flax says super-Mamils are going to see their doctors in search of testosterone prescriptions, whether or not they are strictly necessary for normal life. “That’s where the line gets really fuzzy,” he says. “Suddenly, someone who was feeling a bit tired all the time has testosterone and they’re riding faster. They feel better in the rest of their life, too, so maybe they think: ‘Well, I’m not cheating at all.’”

The further you drop from the rigorous testing of professional sport, the more you rely on the moral compass of each athlete to determine their course – and that’s the problem. It’s hard to know how sport should respond. UK Anti-Doping (UKAD), the body responsible for preventing drugs cheating, says it carried out more than 7,500 tests last year across 47 sports. But it “does not break down its testing figures between professional and amateur sport”. A spokesman added that UKAD was developing a new education programme while targeting supply chains.

Below racing at any level, in the hills of Mallorca or a charity run, does it really matter if people are cheating? “I do think there is something dishonest about it,” Hutchinson says. “Equally, there is something a bit anal about losing sleep over it.”

David Millar cares very little about the threat of cheating super-Mamils. “They’re stupid dudes with too much money and ego. I’d rather put what means and budgets we have into protecting the younger generation,” he explains. Millar now works with British Cycling to mentor the Wiggos of the future. “We’ve now got them into an anti-doping culture where it’s such a non-subject,” he says. “But that’s only at the very top level. It’s the juniors below that we need to get to before it’s too late.”