(Fortune Magazine) -- On the day Paul Hanrahan became employee No. 81 at a startup company known as AES in 1986, he felt liberated.
Hanrahan, who is now CEO of the sprawling global energy firm, had graduated from the U.S. Naval Academy and spent five years on a nuclear-powered spy submarine, where rules and regulations governed everything.
AES (AES, Fortune 500) was different. Really different. The company operated without rules, regulations, or even a well-defined hierarchy. "We don't have procedures," an executive told him. "If we had a procedure, you'd assume we knew what we were doing when we wrote it, and we didn't. So figure it out and use your common sense."
Setting itself apart from the stodgy world of regulated electric utilities -- or any conventional company -- AES trusted people to do good and encouraged them to "step a little bit outside the norm," says Hanrahan. "That was what made AES fun."
At least while it lasted. AES's radically decentralized entrepreneurial culture has been the company's greatest strength and most glaring weakness since its founders, Dennis Bakke and Roger Sant, set up shop as a consulting firm called Applied Energy Services in 1981.
For the next two decades Bakke and Sant took AES on a thrill ride, expanding at a breakneck pace and bringing electricity to remote corners of the globe before nearly driving the company off a cliff. Its stock topped $70 in 2000, then plummeted to less than $1 when the company faced a liquidity crisis in 2002 and called on Hanrahan to right the ship.
Today AES is a case study in how to bring discipline to a large company without killing its essential spirit. AES recorded $16.1 billion in revenue last year, up 16%, and its stock is back up to about $15 a share. Global investors, including China's sovereign wealth fund, China Investment Corp., have approached AES about taking a stake in the company.
Based in Arlington, Va., AES owns and operates power plants and utilities in 29 countries on five continents, ranging from hydroelectric plants in Argentina to coal plants in Kazakhstan to a regulated utility in Indianapolis.
Founders Bakke and Sant met while working on utility deregulation in the Carter administration, after which they saw that business opportunities would arise as the U.S. deregulated power markets and countries around the world privatized their bloated, state-owned utilities.
Brimming with ideas, they made a business out of energy efficiency (showing industrial companies how to save electricity), created the first carbon offsets (planting millions of trees in Guatemala to neutralize emissions from a Connecticut coal plant), and led the company into uncharted territory (building the first privately owned power plants in Mexico and Jordan).
They purposely built a different kind of company. When AES went public in 1991, the company's prospectus said that its core values -- integrity, fairness, fun, and social responsibility -- were more important than the bottom line.
Meanwhile AES built power plants as fast as it could, borrowing whatever money it needed. The payroll grew from 1,400 people to 50,000. "We really did test the limits of how fast a company can grow before things start to fray around the edges," Hanrahan says.
The thrill ride came to an abrupt halt when banks refused to lend to AES after Enron failed. That was ironic because AES was, in many ways, the anti-Enron. It owned hard assets and avoided the energy-trading business and fraud that bankrupted Enron. But AES made mistakes of its own, like overinvesting in Latin America before the 2001 economic crisis. Most of all, AES assumed that it would always be able to borrow whatever money it needed. "You don't finance long-term assets with short-term debt," Hanrahan says. "That was the lesson learned."
Cleaning up the mess has taken years. Between March 2005 and March 2008, AES restated its financials no fewer than six times. "Now I understand what AES stands for," one investor told Hanrahan. "Always explaining something."
A new chief financial officer, Victoria Harker, was hired in 2006; she'd come from WorldCom, where as acting CFO she'd worked her way through the biggest accounting scandal of all time. Even so, she was surprised by what she found at AES. "In some businesses, people who were previously meter readers were providing accounting functions," she says. Not until 2008 did AES comply with the Sarbanes-Oxley requirements.
In the overhaul, Hanrahan and his team had to centralize functions like finance and business development and in some cases even create departments that hadn't existed, like human resources.
Yet the new discipline isn't throttling AES's ambitions. Coming out of the recession, dozens of new plants are on the drawing board, including a coal plant in Vietnam that will be the largest U.S. investment ever in that country. At the same time, AES is making a big push into wind, solar, and other alternative energy projects.
Hanrahan thinks the company has finally found a cultural balance. "There's still a lot of freedom to experiment, to find better ways to do things," Hanrahan says. "But we don't want people to come up with new ideas about how to report income."