By Paul Lukas Reporting by Maggie Overfelt

(FORTUNE Small Business) – "3M" comes from "Minnesota Mining & Manufacturing," but those three M's might better stand for Mistake = Magic = Money. Throughout its 101-year history, many of 3M's breakthrough products have followed a similar arc: A 3M customer identifies a problem, and a 3M engineer expresses confidence in being able to solve it. He bangs his head against the wall for years, facing repeated setbacks, until management finally tells him to stop wasting time and money. Undeterred, the engineer stumbles onto a solution and turns a dead end into a ringing success.

Lots of companies like to talk about giving employees the freedom to make mistakes. But 3M found a way to incorporate random chance into company policy, driving its transformation from a struggling startup to a Fortune 500 mainstay. When Jim Collins and Jerry Porras, co-authors of the besteller Built to Last (1994), asked Bill Hewlett of Hewlett-Packard for a corporate role model, he replied, "3M! You never know what they're going to come up with next. The beauty of it is that they probably don't know what they're going to come up with next either."

Although William McKnight, the man responsible for 3M's entrepreneurial culture, was not, in fact, a company founder, he does deserve the credit for what made 3M successful during his 59 years at the company and beyond. Says Noa Staryk, chair of the McKnight Foundation, which McKnight founded in 1953: "There are two values that resonate from my great-grandfather: innovation and risk taking."

McKnight ended up at 3M by mistake. The company had turned him down for a laborer's job in 1906, and when it wanted to hire him as a bookkeeper a year later, he had already decided to accept a position elsewhere. But upon hearing that his mother was ill, he refused the job offer and prepared to go home--only to learn that his mother had recovered. The only option left was 3M. It turned out to be the best mistake that ever happened to the company.

The birth of 3M sounds like the beginning of a bad joke: A lawyer, a doctor, two railroad execs, and a meat market owner form a company in 1902 in Two Harbors, Minn., expecting to get rich. Minnesota Mining & Manufacturing (quickly nicknamed 3M, although that didn't become the company's official name until last year) set up business to mine a superhard material called corundum, which could be made into high-quality grinding wheels. But "like so many others who organized mining ventures in the early 1900s," wrote Virginia Huck in Brand of the Tartan--The 3M Story (1955), "the founders of 3M apparently incorporated first and investigated later." And their corundum turned into a conundrum: Instead of a prized mineral, it was a soft rock and an inferior abrasive. According to Huck, "By the end of 1904, 3M stock had dropped to the all-time low on the barroom exchange--two shares for a shot, and cheap whiskey at that." 3M's raison d'etre had suddenly evaporated.

The founders shifted gears, entering the abrasives business directly by making their own sandpaper, even though their corundum was virtually worthless as an abrasive. 3M had moved to Duluth, Minn., to make the sandpaper, but the local humidity often kept the product from drying properly. Into this comedy of errors came a shy, red-haired 20-year-old, William McKnight, as an assistant bookkeeper. "I was the scaredest boy that ever lived when I applied for that job," he said. Wrote Huck: "His assets were a most brief business school training [five months], inherent determination, and high ambition. No one who saw the quiet, serious boy apply for the job could have possibly predicted that in a very short time he would become the major influence in the success of 3M."

McKnight was soft-spoken but also direct and efficient. As sales manager in 1911, he established the policy of going into the backroom with a client's workmen--where he could demonstrate 3M products and learn their concerns--instead of just dropping off a catalog in the front office with a purchasing agent. In doing so, he realized that 3M's sandpaper was inconsistent at best, inferior at worst. To increase quality control, he believed the company needed someone to facilitate communications between sales and production. Upper management agreed, and thinking McKnight perfect for the job, named him general manager in 1914.

His tenure started--naturally--with a mistake. Just as the company showed a profit, with sales at about $22,000 a month, angry clients suddenly began returning 3M sandpaper. It turned out that several casks of olive oil had spilled onto a shipment of 3M abrasives in transit, and the oil-tainted "sand" failed to retain its adhesion to the backing paper. And no one had noticed the problem. After that debacle McKnight established a research lab to test materials at every stage of production. It was a crude, closet-sized affair--"I had to back out when Mr. McKnight wanted to come in," recalled William Vievering, the first lab employee--but an important first step.

McKnight's move to center the business on research ended up having the dual effect of not only testing ideas but also generating them. He set the tone with his philosophy of "Listen to anybody with an idea." When he received a letter in 1920 from an ink manufacturer requesting bulk mineral samples (not one of 3M's businesses), McKnight wanted to know what the correspondent would do with the minerals. A Philadelphia inventor named Francis Okie had sent the note, and he wanted to develop his invention of waterproof sandpaper. McKnight realized that Okie's idea would rapidly be accepted because it produced less friction than dry sandpaper and didn't generate hazardous dust when used wet. He bought the rights to the idea and hired Okie, and by 1921, 3M had released Wetordry sandpaper, its first breakthrough product. As Richard Carlton, 3M's director of manufacturing and author of its first testing manual, wrote, "Every idea should have a chance to prove its worth, and this is true for two reasons: (1) If it is good, we want it; (2) if it is not good, we will have purchased peace of mind when we have proved it impractical."

Carlton's philosophy that "You can't stumble if you're not in motion" encapsulates how 3M started making adhesives and became a diversified company. "One morning in 1923, I walked in and heard the choicest profanity I'd ever known," recalled engineer Richard Drew, who had been running some Wetordry tests at a St. Paul auto-body shop. The painter had been having trouble masking one section of a two-tone car (popular in those days) while painting the other. Most tapes at the time were unfit for the task because they left a residue or reacted with the paint. Drew assured the painter that his company could solve the problem, an interesting boast considering 3M made abrasives exclusively at the time.

Drew toiled on the problem for two years. At one point McKnight, by now vice president, wrote him a memo saying, "I think it would be better if you returned to your job of helping Mr. Okie with his waterproof sandpaper." Drew did, but persisted in developing the masking tape, finally finding the right backing paper--his previous sticking point--while on an errand for Okie. The tape, called Scotch masking tape, was immediately successful, with first-year sales of $164,279, rising a decade later to $1.15 million.

Drew followed up that invention by developing an even bigger hit for the company: cellophane tape. Now promoted to technical director from lab assistant (see box), Drew was helping a customer solve its problem of sealing its insulation material in moisture-proof packaging. While working on it, a co-worker evaluated wrapping 3M's masking tape in cellophane. Drew saw the cellophane and thought, "Why couldn't that stuff be coated with adhesive and used as a sealing tape? It's moisture-proof." Although it didn't solve the insulation maker's problem, the company introduced it commercially in 1930.

The story behind the brand name for both of Drew's tapes--Scotch--is unclear, but the common (and probably apocryphal) tale is that one of Drew's early masking-tape prototypes didn't have enough adhesive and kept coming unstuck from the car, leading the painter who was using it to say, "Take this tape back to those Scotch bosses of yours and have them put more adhesive on it!" That reference to the notion, common then, that Scots were stingy, ironically served 3M well during the Depression, when Scotch cellophane tape became a symbol of thrift and do-it-yourself mending.

After the development of masking tape, McKnight learned a crucial lesson about letting his engineers follow their instincts. He soon codified this lesson into a policy known as the 15% rule. "Encourage experimental doodling," he told his managers. "If you put fences around people, you get sheep. Give people the room they need." Still in place today, the rule lets 3M engineers spend up to 15% of their work time pursuing whatever project they like. Subsequent policies and programs--like Genesis Grants (an internal venture capital fund available to engineers whose ideas have been turned down by management) and the 25% rule (requiring that each division generate a quarter of its sales from products introduced within the past five years), which in 1993 became the 30% rule--furthered 3M's climate of innovation.

The result was a steady steam of inventions, all with the sort of palpable "Aha!" moments that become the stuff of legend. Philip Palmquist had been working on a project in the 1930s to make durable and reflective road stripes. "After they dumped the project," recalled Ardell Palmquist, his wife, to the Minneapolis Star Tribune, "Phil went back on his own at night." In the process he invented Scotchlite, making possible the first reflective traffic signs in 1939. In the late 1940s some fluorochemical experiments were going nowhere when a lab associate accidentally spilled a solution on her shoes. Chemists Patsy Sherman and Sam Smith noticed that the affected area resisted soiling, and that was the beginning of Scotchgard fabric protectors, which debuted in 1956. In 1974, Art Fry got the idea for Post-it Notes when his paper bookmarks flew out of his choir hymnal and he paired up his idea with a low-adhesive glue developed by another 3Mer.

In 1948, McKnight reorganized the company, creating eight divisions and making them largely autonomous. He boiled down his management style into a credo called the McKnight Principles, which formed the backbone of 3M's corporate culture. Its crucial passage reads, "Mistakes will be made, but if the man is essentially right himself, I think the mistakes he makes are not so serious in the long run as the mistakes management makes if it is dictatorial and if it undertakes to tell men ... exactly how they must do their job." The McKnight Principles' success is apparent in the company's growth during McKnight's tenure: When he became general manager in 1914, 3M was a $264,000 company; by the time he was made president in 1929, annual revenues were $5.5 million; in 1943, 3M generated $47.2 million, and by the time of McKnight's retirement as chairman in 1966, he had grown 3M into a $1.15 billion operation.

McKnight's disciples followed his principles, and the company continued to grow in the '60s, '70s, and '80s. Global expansion and products such as Post-it Notes (released in 1980) and a drug to control an irregular heartbeat kept fueling the company. But trouble started sometime in the 1990s. "For decades management books have called 3M a model," reported the Los Angeles Times in 1995. "Yet the glow of such compliments may have distracted the company, because in this decade 3M allowed old, less profitable products to drag down its earnings growth and stock price." As an analyst told Fortune last year, "I think to a certain extent 3M was starting to get fat and happy."

In December 2000, to shake up the culture, 3M hired General Electric veteran James McNerney as CEO, the first outsider to run the company in its history. Two years later it appears McNerney and McKnight can coexist. The new CEO has cut overhead and instituted new job-review procedures while retaining 3M's product diversity and commitment to research (the R&D budget is about $1 billion, or 7% of annual sales). As McNerney himself put it last year, "I think we're world-class at the front end of the [innovation] process. If I dampen our enthusiasm for that, I've really screwed it up." Now that would be a mistake.