FORTUNE — Even with my helmet on, the roar inside the Grumman C-2A Greyhound is deafening. The twin-prop Navy plane is 100 miles north of Oahu, flying toward the carrier USS Nimitz, which is slicing through the Pacific at 30 knots. I’m seated backward in the stripped-down cabin of the craft. Through a tiny window I can see the vast expanse of blue ocean striated with whitecaps. In the rear row of seats, Petty Officer Weaver starts frantically waving his right arm in a circle — the signal that we’ll hit the carrier’s deck in 10 seconds. I grab my shoulder harness with both hands, put my feet flat on the floor, tuck my chin into my chest, and start counting down: nine, eight, seven … The aircraft slams onto the deck, catches the tail-hook cable, and stops dead: 150 mph to zero in two seconds. I feel like my stomach got left somewhere back in Waikiki.
To Navy pilots, making a pinpoint landing on a carrier — which from 15,000 feet looks like a postage stamp — is what they do every day and do well. But here’s the unusual thing about this flight: It was the first carrier landing ever by an aircraft powered by biofuels — in this case, a brew consisting of algae and used cooking oil. Our flight on this July day was part of a massive Navy demonstration dubbed the Great Green Fleet. The Nimitz, accompanied by a task force of destroyers — running on biofuels and with special tail flaps to reduce drag and boost fuel economy — was there to show off the Navy’s vision of the future: a military force no longer dependent on foreign oil. As the day progressed, F-18s powered by biofuels took off from the carrier deck. In all, 71 aircraft flew on alternatives — 450,000 gallons were burned that day — including a helicopter carrying Secretary of the Navy Ray Mabus.
Mabus’s presence on the carrier was, of course, a public relations stunt, but it was also a signal that he has staked his reputation on this radical program. On the Nimitz, as fighter jets screamed while taking off from the flight deck, Mabus pledged that by 2020 the Navy would reduce its dependence on fossil fuels by half — a stretch goal by any measure. “This is not about being green,” he said. “This is about national security.” By that he means that every time the price of oil rises, that extra money has to come from somewhere, and that can force the military to make tough choices.
In an exclusive interview with Fortune, the Navy secretary explained, “Here are the choices I don’t want to make: between paying additional fuel costs and flying and steaming less; between paying additional fuel costs and building fewer ships and planes. And that’s where we’re getting pushed if we don’t develop alternative energy.” And he’s not talking small change. In 2008, for instance, the Navy’s fuel bill jumped to $5.1 billion, from $1.3 billion the year before, as the price of crude spiked to over $140 a barrel. (Although the price of oil has fallen since then, the Navy’s fuel bill was still a hefty $4.7 billion last year.)
To achieve its 50% renewables goal by 2020, the Navy is taking a two-pronged approach. First it plans to invest heavily in the advanced biofuel industry and help drive down the price of next-generation biofuel until it becomes competitive with oil. Next, it is making its planes, ships, bases, and equipment as energy efficient as possible.
The Navy secretary’s quest to use biofuel has drawn heavy fire from Congress. At a time when the Defense Department faces as much as $1 trillion in cuts over the next decade, some in Congress question why the Navy is spending money on biofuels that cost more than oil. Congressman J. Randy Forbes (R-Va.), who chairs the House Armed Services Readiness Subcommittee, is one of those skeptics. “We need some analysis before the Navy spends millions on biofuels, and they have zero analysis,” says Forbes.
In May the House added an amendment to the National Defense Authorization Act that would prohibit the Navy from buying any fuel that is not cost competitive with oil. The bill has passed the House and is moving through the Senate. In an earlier congressional hearing on defense spending, Forbes had confronted Mabus: “You’re not the secretary of energy. You’re the secretary of the Navy,” he snapped.
Mabus says that the Navy has studied biofuels and that it won’t buy them in large amounts until they are cost competitive. He also feels confident that he has the support in Congress to remove the amendment from the bill. “I’m very optimistic that this will happen,” says Mabus, “because this is not something we’d like to do. It’s something we need to do to make us a less vulnerable military force.”
Even if he does lose that battle in Congress, Mabus still plans to put money into biofuels. Over the next few years the Navy will invest $170 million in private-sector companies that are building advanced biofuel refineries and will receive equity in return. (The Department of Energy and the Department of Agriculture are contributing another $170 million each.) To justify this venture capital-like approach, Mabus cites a 1950s law called the Defense Production Act, which allows the Defense Department to back nascent industries important to national security. The government has played this role before, investing in and helping to develop technologies such as microchips, radar, and GPS until the price came down enough for those products to take off in the private sector. In the 1960s, for instance, the law allowed the DoD to invest in the embryonic semiconductor industry until prices fell enough for them to become affordable. (See chart below.)
The Navy has a long history of supporting and guiding emerging private-sector industries. According to the book Round-Shot to Rockets by Taylor Peck, in the 1880s the steel industry in America was booming, but the Navy was still building its ships with foreign steel because U.S. companies weren’t making the high-quality steel needed for battleships. The Navy began to worry that foreign sourcing was too big a vulnerability. So in 1886, the Navy ordered that all steel, armor, and ordnance for U.S. ships should be made in America. By the time World War I started not only was the Navy building its ships from domestic steel but also the U.S. steel industry had become a world leader in manufacturing high-quality steel for shipbuilding.
The Navy has played a similar role with new energy technologies. When the service switched from sail to coal in the mid 1800s, then from coal to oil in the early 20th century, and from oil to nuclear in the 1950s, each time the new technology cost more. “Whenever we changed to a more expensive technology,” says Mabus, “there were lots of naysayers who said, ‘It’s too expensive; it’s not proven.'” Mabus believes the move to biofuels will play out the same way.
“What the Navy has to argue to win this fight,” says Jan van Tol, a senior fellow with the Center for Strategic and Budgetary Assessments, a nonpartisan think tank, “is that though biofuels seem like an enormously expensive cost in the short run, in the long run it will be cheaper than fossil fuels.”
A naval office who served on the cruiser the USS Little Rock and a former Democratic governor of Mississippi, Mabus got religion on alternative energy while working in the Middle East. He saw firsthand the danger of being dependent on foreign oil when he served as the U.S. ambassador to Saudi Arabia during the Clinton administration. In the wake of oil price spikes, the administration would ask Saudi Arabia to boost production. “My time in Saudi showed that oil is a worldwide commodity and that no one controls the price,” says Mabus. “Every time I’d see the oil minister there, I’d say, ‘What’s the price of oil going to do?’ And he’d say, ‘Well, it could go up and it could go down.'”
It’s not only that America depends on foreign nations for its oil — the U.S. still imports 45% of what it uses — but also that speculators and swings in supply due to wars, revolts, terrorism, and accidents, such as the BP (BP) spill in the Gulf of Mexico, make oil prices highly volatile. Mabus believes that a stable domestic source of biofuels will iron out those price swings. He also says that when he was appointed secretary in 2009, fuel security and cost cropped up as a top concern of the admirals.
At its Great Green Fleet demonstration, the Navy used so-called next-generation biofuels to fly its planes and power its ships. Today corn ethanol is the most plentiful biofuel available in the U.S. Ethanol is now cheaper than gasoline, and this year motorists will use roughly 13 billion gallons, for about 10% of total U.S. gasoline consumption. But corn ethanol has its drawbacks. For one, it competes with food, potentially driving up prices. Also, some studies suggest that all the CO2 released in growing corn and making ethanol means that corn doesn’t have much of an advantage, if any, over oil when it comes to greenhouse-gas emissions. Plus, the fuel can’t be used in jets and ships without modifications to the engines and provides less range per gallon than fossil fuels.
By contrast, the next-generation biofuels the Navy has tested are made not from corn, sugar cane, or other food sources but from camelina (an oilseed plant), algae, and waste oils such as cooking grease and chicken fat. They can be used in regular ships and jets without modifying the engines. Why? Because they’re hydrocarbons — identical in molecular structure to fossil fuels. According to the EPA, next-generation fuels have a lower carbon footprint than oil. The Federal Renewable Fuel Standard (RFS), passed in 2005 by Congress, requires that by 2022 the country use 21 billion gallons of advanced biofuels, up from about 2 billion gallons that will be produced this year, according to the Advanced Biofuels Association. (That 21 billion gallons equates to about 15% of today’s gasoline market.) At the same time the RFS mandates that advanced biofuels cut greenhouse emissions by at least 50% compared with oil. One example of how that could work: The algae the California startup Solazyme (SZYM) made for the Navy sucks carbon dioxide out of the air as it’s growing, creating a low-carbon cycle.
The catch is the price. As with any new technology, next-gen biofuels are expensive. That’s because oil is a business of scale, and the new fuels are being produced in small quantities. According to the Navy, the biofuel used in the Great Green Fleet demonstration cost $26 a gallon. Some in Congress, like Forbes and Sen. John McCain of Arizona, a former Navy aviator, questioned why the Navy would pay such a sky-high price. (The fuel used in the exercises was actually a fifty-fifty blend of bio- and fossil-fuels, which brought the average cost down to $15 a gallon.) The batch of biofuels in question was made by Dynamic Fuels, a Louisiana joint venture between Tyson Foods (TSN) and Syntroleum (SYNM), a developer of renewable-fuel technology. And the premium the Navy paid reflects the cost of R&D, testing, and certification done by the manufacturers. Experts say this kind of biofuel can be made in commercial amounts for about $4 to $5 a gallon wholesale, compared with about $3 for diesel fuel. That’s still a stiff price disadvantage, but one that’s easier to bridge than the $26-a-gallon price tag.
Once they scale, biofuels have a good chance of becoming price competitive. Today there are at least 100 companies worldwide working on advanced biofuels, ranging from big corporations like chemical giant DuPont (DD) and the oil refiner Valero (VLO) to startups such as Amyris (AMRS), Dynamic Fuels, KiOR (KIOR), and Solazyme. How long it will take them to drive prices down depends in part on whether the Navy can keep supporting the industry. Mabus cites studies suggesting that next-generation biofuels could become cost competitive sometime between 2018 and 2022, and he believes the Navy’s program could speed that up by a few years. If the airline industry starts buying in meaningful quantities — two executives for United Airlines (UAL) attended the Great Green Fleet demo and are working with the Navy on biofuels for aviation — the timetable could speed up even more.
As the Navy pushes ahead on its biofuels program, it is putting equal effort into boosting the energy efficiency of its ships, land bases, and front-line fighting forces. The best example is perhaps the USS Makin Island, an 847-foot-long amphibious assault ship that runs on a hybrid powertrain. The ship’s two main gas turbines can push this 41,649-ton vessel to 25 knots. But most of the time the ship cruises under 12 knots. At those speeds the Makin Island switches to a highly efficient diesel-electric propulsion system. The Navy estimates that over the life of the ship the hybrid system will save $250 million in fuel costs, even after the expense of the hybrid system is accounted for. The Navy also plans to use the hybrid system in its new fleet of guided-missile destroyers.
There are tactical advantages to efficiency as well. “This isn’t only about saving money,” says Vice Adm. Philip Cullom, the Navy’s deputy chief of Naval operations for fleet readiness and logistics. When Cullom was serving in the Adriatic off the coast of Kosovo in the 1990s, his mission was to fire Tomahawk missiles to support U.S. land troops. However, he had to leave his position every four days to refuel where it was safe. (Ships are sitting ducks when they’re refueling.) Sometimes that took him out of action for as long as 12 hours. “I did all I could to save fuel,” says Cullom. “But at some point you need technology to help you, and that’s what the hybrid drives are about.” The Navy is also installing stern flaps on its ships to reduce drag and boost fuel economy, as well as energy-efficient LED lighting.
The onshore assault is just as aggressive. The Navy owns 3.3 million acres of land and 72,500 buildings. To cut energy use at its ground operations the service is evaluating all sorts of alternative-energy technologies, from geothermal to wave, solar, and tidal. For example, it broke ground this year on a 118-acre solar farm in China Lake, Calif. The solar farm is part of a larger DoD initiative. In August, Secretary of Defense Leon Panetta announced that the military will open 16 million acres of its land for renewable-energy development. The Pentagon believes that by creating green microgrids — self-contained power sources — at its bases it will be able to maintain operations despite blackouts or cyberattacks on the national grid.
Perhaps the most important breakthroughs, though, can be found on the field of battle. The Marines, which operate under the Secretary of the Navy, conducted a study that showed that in Afghanistan one soldier is killed or wounded for every 50 convoys of fuel and water. So the Marines now give their front-line troops “solar blankets” to charge their radios and GPS. Made by Iris Technologies of Irvine, Calif., these devices use the sun’s energy to generate electricity for recharging batteries. A Marine battalion in Afghanistan that uses the blanket was able to shed some 700 pounds of batteries, and the battalion doesn’t need to be resupplied as often with fuel to run diesel generators.
One often overlooked but nonetheless crucial aspect of the Navy’s effort to become more sustainable is the culture change that it’s driving in the rank and file. The Navy has created programs to train its sailors and Marines to be more aware of the importance of energy savings, the dangers posed by being dependent on foreign oil, and the need to preserve natural resources such as water. Says Mabus: “We’ve got SEAL teams now that are trying to be net zero in terms of both fuel and water.” Every year 100,000 or so clean-cut young men and women leave the military and return home with a new perspective on how the world should work. Many will become leaders in their communities who, in the long run, might very well help change the way we live. In the end, that might be the Great Green Fleet’s lasting legacy.
This story is from the September 3, 2012 issue of Fortune.