On election night this November in Boulder, Colo., under the stained-glass ceiling of the Hotel Boulderado, about 100 progressive-leaning voters crowded around a screen showing preliminary results. Early in the evening, the odds of the city breaking its ties with Minnesota-based corporate utility Xcel Energy to pursue locally produced, clean power seemed as dark as the storm clouds accumulating over the Rockies. But around 9 p.m., Measure 2C, which gives the city permission to create a municipal electric utility, took the lead. Cheers and upward-thrusting thumbs burst from the crowd. Sometime after midnight, another ballot measure -- which would raise a tax to pay for planning that utility -- also edged ahead, eventually passing by just 50.4 percent.

The campaign had been bitterly fought. Xcel poured over $960,000 into the opposition, which hired canvassers for $12.50 an hour on Craigslist. The four pro-municipalization groups spent about a tenth of that, but mustered celebrity support from President Obama's ex-green jobs czar Van Jones and Boulder author Jon Krakauer. At one point, Xcel threatened to cut Boulder customers off from renewable energy programs if the measures passed, a move Mayor Susan Osborne told the local newspaper was "a transparent ploy by a desperate corporation."

If Boulder actually creates its own utility, Xcel does have a lot to lose: about 46,800 customers and some $114 million in annual sales. The city, however, has much to gain, supporters say. With a local utility, Boulder could choose its power sources, boosting the city's ambitious efforts to shrink its carbon footprint. It also would be the first U.S. city driven to municipal power primarily for environmental reasons. "For a municipalization campaign to go ahead based on that kind of worldview is something new," says Paul Fenn, an energy consultant for the city.

Xcel Energy, which operates in eight states, actually leads the nation's utilities in wind power and is on track to meet Colorado's 30 percent renewable energy standard by 2020, the second-highest in the country. But Boulder activists say that's not enough to address climate change. By ditching coal and encouraging local power production and energy efficiency, the city hopes to cut more carbon while keeping rates competitive, and perhaps reinvent the electric grid in the process. Many questions remain, however, about whether Boulder can strike out on its own.

"Our example right now is a plucky, little liberal place that decided to make a move away from coal-based electricity," said Osborne the morning after the election. "If we are ultimately successful, that really will be a path for others to follow."

Known for its über-fit, ultra-green, extra-educated progressivism, Boulder has led efforts toward urban sustainability for years. In 2002, the city committed to cutting its carbon emissions below 1990 levels within 10 years to meet the Kyoto Protocol, the international standard shunned by the federal government. In 2006, it became the first U.S. city to impose a carbon tax to fund energy-conservation programs, hiring roaming technicians who change light bulbs and even inflate car tires for free. The idea was to reduce emissions by cutting consumption. But though Boulder's emissions haven't grown since these programs began, they haven't declined either. In 2009, city officials concluded they couldn't meet their climate goals without addressing the supply side of their energy equation.

Municipal utilities allow local governments to do just that by buying power on the open market or building generation facilities. But making the switch isn't easy, and many attempts fail under intense opposition from powerful utilities. San Francisco tried to municipalize in 2002, but a $2 million campaign by Pacific Gas and Electric helped defeat the ballot initiative. Actually creating a new utility is a complicated, expensive endeavor that requires a city to buy electric poles and wires and often haggle over costs in drawn-out legal fights. In 2000, Las Cruces, N.M., gave up when the amount it owed its corporate utility for already-made local investments ballooned.

Still, over the last decade, 13 municipalities have succeeded. Jefferson County, Wash., voted in 2008 to split from Puget Sound Energy to reduce rates, create local jobs and increase renewables; its new utility will start up in 2013. Winter Park, Fla., citing unreliable service, did the same in 2005, and now its public utility is recovering from early financial problems.

Other communities have used a softer approach to take control of their power supply. Community choice aggregation, or CCA, lets communities buy energy from where they choose, while the utility continues to own and manage the power lines, removing much of the upfront cost of municipalization. Marin County, Calif., adopted CCA in 2010 and now offers at least 27 percent renewable power at competitive rates. But CCA is not legal in Colorado or any other Western state except California, so Boulder had to go it alone.

The city and Xcel have tried to work out their differences. In 2008, Xcel offered to make Boulder the testing ground for a "smart grid" that lets consumers monitor their energy-use rates and save energy by changing their habits. But by 2010, rising costs thwarted the program's completion. This February, Xcel dropped a popular rebate for solar panel installations, and cut subsidies when a settlement with the solar industry restarted the program. Xcel also opposed state legislation to look at paying homeowners more for rooftop solar power -- an incentive for local power production. As a last-ditch effort, Xcel offered to offset most of Boulder's energy use with renewable energy credits from a wind farm being built in eastern Colorado. But the long-term cost to ratepayers was uncertain, so in July, Boulder said no.

"They are stuck in this business model that isn't compatible with our goals," says Jonathan Koehn, regional sustainability coordinator for the city. Xcel and other private utilities make money by building large power plants and transmission lines, and then increasing rates in order to collect a return on those investments. Xcel still gets most of its power from coal plants and has little incentive to shut down or cut production from existing facilities, beyond what the state requires. And it's not easy to dial down a coal plant's power generation when weather conditions drive wind and solar production up, further limiting the amount of renewables that can get on the grid.

"The whole system seems to be rigged against maximizing non-coal-based electrical energy," says Osborne. "We were just being hog-tied." Instead of adding renewables to a coal-fired base, a Boulder-run utility could start from scratch. Estimates vary widely, but by using cleaner-burning natural gas power, the city could provide about 40 percent renewables and cut carbon emissions by over 60 percent without increasing rates, according to one local study by pro-muni experts. Eventually, Boulder aims to increase small-scale renewable energy, produced locally rather than at distant, sprawling wind and solar farms. And by expanding the smart grid and using innovative gadgets developed by Boulder companies, the city hopes to pioneer the electric grid of the future -- one where excess wind power is automatically diverted to charge electric cars, and consumers set appliances to run when demand is low and rates cheaper.

But first, Boulder must determine if a municipal utility is financially feasible and the best way to meet its environmental goals. It must confront sizable and uncertain start-up costs, a steep learning curve and a divided community. The city will have to negotiate the exact costs of the separation with Xcel - and likely go to court - while Xcel continues to power the city. That process alone could take five years and cost up to $10 million, paid for by the new tax.

Actually starting the utility will cost much more: at least $286 million, according to the city, which would recoup that cost by selling power. Xcel's consultants, however, estimate the tab could run as high as $1.2 billion. Boulder would have to purchase electric poles and wires from Xcel for about $121 million to $150 million. It may also have to reimburse Xcel for investments it made for the city's future energy needs, possibly running into the hundreds of millions. "We're skeptical that the city will be able to meet the terms of the initiative and match our rates, let alone match our level of renewables," said Xcel CEO Ben Fowke after the election.

Boulder says municipalization will only proceed if the city can match Xcel's rates when it takes over. And public utilities do have some financial advantages: The city can take on debt at cheaper interest rates than Xcel can and isn't obligated to turn a profit for shareholders. (Boulder ratepayers contribute $14 million to $18 million annually to Xcel's profits, the city estimates.) According to the American Public Power Association, in 2009, residential customers of privately owned utilities paid, on average, 15 percent more for electricity than those using public power.

Judging by the close vote, though, many Boulderites wonder if it's worth the upfront expense. The city isn't required to match Xcel's rates in the future. And although clean energy is clearly a priority, nothing in the ballot measures requires Boulder to provide more alternative energy. "Municipalizing doesn't shut down a single coal plant," says David Miller, a Boulder attorney and chairman of the citizens' opposition group. "(It's) really a reckless way to get to your renewable energy goals." Leaving behind statewide efforts to cut carbon emissions is counterproductive, Miller says, and the millions spent to study the new utility would be better spent reducing energy use.

For now, Boulder is keeping its options open. A month after the election, the city began exploring other paths to local control such as legalizing community choice aggregation in Colorado -- and discussed using the support for public power as leverage to bring Xcel behind the effort. "We didn't go into this with the aim to own power poles and wires," says Koehn. "The goal is to have control over the decisions being made."