When Nino Schurter and Jenny Rissveds took gold medals for mountain biking at the Rio Olympics last month, they owed their rides in large part to Tom Ritchey, who’s been building bicycles since he was 15.

Ritchey, one of the key figures in the growth of the Bay Area’s bicycling culture, was not your average sophomore back in 1971. Already a phenomenon in road racing, the Palo Alto teenager had a burgeoning business as a custom bike frame builder. High school was proving something of an obstacle, though.

After coming up with a detailed daily schedule that would allow him to train for the national cycling team and build 50 frames a year, he met with the principal of Palo Alto High School. His proposal: go to school from 8:20 to 11:40 a.m. for the next two years, which would give him just enough credits to graduate. When the idea was rejected, Ritchey presented the same plan to nearby Cubberley High School. Its principal agreed to it, and Ritchey promptly transferred, leaving a few startled friends in his wake.

With an engineer for a father, a garage full of tools and the kind of freedom few children are given today, Ritchey built a tree fort at age 5, an electric car when he was 12 and his first bike frame at 15. Never idle, his hands were always holding a tool, a torch or a pair of handlebars as he sought to build a lighter, stronger, better bicycle and win the next race. On this score, little has changed in five decades.

Ritchey is the founder and owner of Ritchey Design, a multimillion-dollar bicycle component company which dates back to 1983 and today has offices in San Carlos; Sparks, Nev.; Lugano, Switzerland; and Taichung, Taiwan. He still runs product design, and played a key role in developing the cutting-edge handlebars, grips, stems, seatposts, saddles and pedals used by Schurter and Rissveds, both members of a Ritchey-sponsored Swiss bicycling team.

Their double victory was icing on the cake of a year that has seen Ritchey Design roll out its largest-ever lineup of products, including the return of complete mountain bikes, something it last sold in 1989. His cycling wares command high prices: A top-of-the-line Superlogic Carbon stem, prized for its stiffness, costs $280, while a fully equipped Timberwolf mountain bike, a reborn version of a model introduced in 1984, sells for $3,999. What makes Ritchey unique, however, is that unlike his peers who helped develop the first mountain bikes, he still owns the company that carries his name.

He almost lost it.

The mid-1990s appeared to be Ritchey Design’s heyday. He’d built the company into an internationally recognized brand. Its parts appeared in mountain and road bikes, and cyclists coveted Ritchey’s frames. The mountain bike team was the dominant force in cross-country racing, earning a succession of national and international victories. Rider Thomas Frischknecht, who remains one of Ritchey’s closest friends, earned a silver medal in the sport’s Olympic debut in 1996.

But for Ritchey, things looked very different. A wave of consolidation was sweeping through the industry. Gary Fisher Mountain Bikes was bought by corporate heavyweight Trek in 1993. Two years later, Trek acquired Santa Cruz’s Bontrager Cycles. Though Ritchey had previously spurned suitors, he reconsidered. Specialized, Trek’s main rival, had come calling in the ’80s, and Ritchey had known its founder, Mike Sinyard, for 20 years. But it was not until 1995 that the two finally talked seriously about a deal.

Ritchey’s company was at an impasse. “We were a global business, but in terms of systems, we were the biggest small company out there,” Ritchey said. “It was obvious that the operations side of the company, the back end, was my weakness.” Specialized had the cutting-edge operations Ritchey couldn’t afford on his own.

And he wanted to preserve his quality of life. As he had done since founding his company, Ritchey worked from his house, a cabin he built himself, tucked in the forested hills of Woodside. With his workshop and a network of mountain bike trails right outside his front door, Ritchey was able to ride at will and develop products while still being there for his wife and three adolescent children. “I had the dream life,” he said. Expanding the company on his own, or at least weathering the current storm, might threaten that.

Sinyard let Ritchey write his own rules, which meant remaining autonomous while gaining Specialized’s support for operations. And Ritchey parts would go into Specialized bikes, a steady source of business. It seemed to be exactly what he wanted. Ritchey merged his company with Specialized, completing the deal in October 1995. (Both companies are private, and Ritchey wouldn’t disclose what the deal was worth.)

In less than a year, the bike market experienced a major downturn, one that hit Specialized especially hard. “By the end of 1996 we had lost about 30 percent of the bike store business and came within a few hundred dollars of declaring bankruptcy,” Sinyard told Fortune Small Business in 2008. A management shakeup soon followed. Ritchey found himself dealing with new faces.

Specialized offered to buy Ritchey out, which would have let him spend plenty of time on the trails and with his family. But Ritchey was not interested in padding his bank account. “It’s never been about the money for me,” he said. Plus Ritchey’s staff would probably have lost their jobs, and Ritchey himself would have ended up handcuffed to Specialized for a few years, working in a vestigial role. Then there was the inevitable devaluation of the Ritchey brand. “There are real, real downsides to somebody else taking over your name — and your history,” Ritchey said. “I’m not saying it doesn’t work out for people, but I knew I would not do well with that decision.”

But getting his company back cost him more than he imagined.

First of all, it took nearly four years to unwind the deal. “That was my first deep dive into the legal world and how much it costs,” she said. Ritchey Design wasn’t back on its own until 2000 — right in time for the dot-com bust.

The bike business reeled along with the rest of the economy. San Jose’s RockShox, worth hundreds of millions of dollars after it went public in 1996, was sold for $12 million in 2002. Though still profitable, Ritchey Design’s annual revenue was down considerably from its premerger peak of $20 million.

Things got ugly. Two of Ritchey’s key employees “had gone AWOL,” and there was a lot of petty infighting. “I ended up having such a dysfunctional company,” he said. “There are people that you thought you trusted that do strange things.”

In the midst of all this came the real shocker: After 25 years of marriage, Ritchey’s wife, Katie, left him.

Though he talks with a measured cadence, Ritchey is usually never at a loss for words. But when talking about this period, “a time where the wheels came off,” there were long pauses in the conversation.

But he had friends. And his bike. Through it all, Ritchey kept riding — a lot.

Though there was nothing he could do to salvage his marriage, it was another story with his company. “I had to do some very heavy-duty firing,” he said. “I had to move fast.” This was a drastic change for a hands-off manager, but he had no choice. The ship, he said, “was sinking.”

He rebuilt his component sales. He even talked to Trek, Specialized’s archrival, which gave him an audience out of courtesy. He landed contracts with Schwinn and GT, well-known companies that were reinventing themselves at the time and could benefit from Ritchey’s reputation. Some previous customers returned to the Ritchey fold.

All great turnarounds need a guru, and Ritchey found his after building an airplane, a way for the inveterate tinker to deal with anxiety and find balance. Needing to learn how to fly his lightweight carbon-fiber craft, Ritchey called a flight instructor named John Frechette. In addition to training pilots, Frechette had run divisions for Levi Strauss & Co. and Russell Athletics. When Ritchey first talked to him, Frechette was recuperating from a bout of cancer.

After a two-hour heart-to-heart on the phone, Ritchey made Frechette a proposal: “How would you like to help a really small company with big needs?” After a few months, Frechette became Ritchey Design’s chief operating officer. It took several years, but Frechette accomplished what Ritchey had sought through the Specialized deal, and turned Ritchey Design into a well-run company. It now has some 50 employees around the world.

Frechette’s hiring let Ritchey focus on new products. Wanting to fit a full-size bike in his tiny airplane, Ritchey created the Break-Away frame. With a deceptively simple coupling system, it can fold up for traveling while retaining the appearance and performance of a normal frame. Released in 2006, this product also marked Ritchey Design’s return to frame production.

When asked to reflect on the merger, getting back his company and the struggle to right it, a knowing grin forms under Ritchey’s handlebar mustache. “I survived some big mistakes,” he said. “I survived myself, and I’m on the other side of that now.”

Today, even with his seventh decade right around the corner, the enviably fit Ritchey seems to be in the prime of his life. Happily remarried, he’s riding his bike just as much as ever. “My bike is an extension of who I am,” he said. “Riding just leads to good things.”

“People don’t know how to find balance in life,” Ritchey said. On that score, he seems to have done better than most.

Eric Gustafson is a freelance writer. E-mail: business@sfchronicle.com