California's first-in-the-nation requirement that all new homes have solar panels is a giant leap toward its goal of a fossil-free future, but the challenge of managing a surge of electricity to the grid could keep other states — even sun-soaked ones — from following suit.

Opposition from utilities and homebuilders, and a slower return on investment, also could stall similar efforts in other states.

With 80,000 houses built in California each year, the mandate that takes effect in 2020 will more than double the amount of solar energy produced in the state by 2025, the state said. California hopes to have 100 percent of its electricity come from carbon emission-free sources by 2045.

But energy experts, even those supportive of renewable energy, say the move could create difficulties for the state's electric grid as more residents contribute energy to the grid by selling their excess solar power. Utilities will have to manage that increase in energy production to keep it from overwhelming the system.

"Yes, all that solar going on the grid in the middle of the day is undeniably a challenge," said K Kaufmann of Fluence, an energy storage company. "However, there are a range of potential solutions and more will be developed. This is going to spark a lot of innovation."

Cloudy states may not be tempted to follow California's lead, but other sunny states, particularly those with ambitious clean energy goals, will be watching to see how its utilities adapt. A few cities in California have within the past few years implemented requirements that all new homes have solar panels, as has the town of South Miami in Florida, but this is the first time a mandate will be rolled out on such a large scale.

"We should recognize this as a pretty historical decision," said Sean Gallagher, vice president of state affairs for the Solar Energy Industries Association. "This is a further step in solar going from what was a niche product a few years ago to becoming as common as the front door on a home."

The California Energy Commission, which voted unanimously to add the solar panel requirement to the state building code, said the cost-benefit analysis made it a straightforward decision. Though the measure on average will add about $8,400 to the cost of building a home, that is less than what owners will save on their electric bills.

But the same may not hold true in many other states. Though California's homebuilders ultimately supported the measure, their national advocacy group opposes such mandates elsewhere.

"Based on our estimates, we don't believe it would be cost-effective or in the best interest of consumers to mandate solar panels in other states," Liz Thompson, director of media relations for the National Association of Home Builders, said in an e-mail.

Utility and housing prices in other states may prevent a return on the investment for homeowners, she said.

Other factors could change the financial calculations. Utilities in some states have pushed hard against rooftop solar, since keeping solar production in the hands of utilities ensures they retain their customer base.

And how much utilities in other states would be required to pay homeowners for the electricity they contribute would make a big difference in how quickly homeowners could recoup their costs.

California regulators discussed a potential solar mandate for the better part of a decade, part of the California Public Utilities Commission's effort to make new homes "zero net energy," essentially producing as much energy as they consume over the course of a year.

As technological advances drove down the price of solar panels, California enacted stricter efficiency standards for homes, such as insulation and lighting requirements, California Energy Commission spokeswoman Amber Beck explained, reducing the wattage of solar needed to supply a home. That meant a solar power system would be cheap enough to meet the commission's strict standard that new rules be cost-effective.

Adding solar panels to a home is expected to boost average monthly mortgage payments by $40, while homeowners would save an average of about $80 a month on their electricity bills, according to the California Energy Commission.

Despite initial concerns over costs, California builders supported the mandate because of flexibility in how they can comply, said Bob Raymer of the California Building Industry Association.