SACRAMENTO, Calif. — California has set a goal of phasing out electricity produced by fossil fuels by 2045 under legislation signed Monday by Gov. Jerry Brown.

Brown, who has positioned California as a global leader in the effort to reduce greenhouse gas emissions, approved the measure as he prepares to host a summit in San Francisco of climate change leaders from around the world starting Wednesday.

The renewable energy measure would require California’s utilities to generate 60 percent of their energy from wind, solar and other specific renewable sources by 2030. That’s 10 percent higher than the current mandate.

The goal would then be to use only carbon-free sources to generate electricity by 2045. It’s merely a goal, with no mandate or penalty for falling short.

“It’s not going to be easy and will not be immediate, but it must be done,” Brown said. “California is committed to doing whatever is necessary to meet the existential threat of climate change.”

Phasing out fossil fuels would be a massive change in the energy grid. Utilities rely on natural gas plants to meet demand when renewables fall short, particularly in the early evening when the sun sets and people turn on their air conditioners as they get home from work.

Utilities are already dealing with an abundance of solar energy during peak times, which must be offloaded to other states when there’s not enough demand locally for the power.

Renewable energy experts have looked to batteries that can store solar energy generated in the afternoon as one solution, but the technology is not ready for wide-scale deployment. Another potential solution is pumped storage, in which water is pumped uphill in the afternoon using solar energy and then released through hydroelectric generators after the sun sets.

Brown has often faced criticism that he’s too cozy with the oil industry, including from environmental groups that plan to protest at the San Francisco summit. They’re pushing him to create a moratorium on new oil wells in the state.

California ranked sixth among states in crude oil production in May, the latest data available from the U.S. Energy Information Administration. The state ranks 15th in natural gas production. California’s production of crude oil has fallen steadily since the mid-1980s.

Critics say the renewable energy goal is not realistic and worry individuals and businesses will face higher energy prices.

The measure was written by state Sen. Kevin de Leon, a Los Angeles Democrat who is running for U.S. Senate against fellow Democratic U.S. Sen. Dianne Feinstein.

“Today we’re setting a marker that will be remembered by future generations,” de Leon said.

California has met its goal to reduce total greenhouse gas emissions to 1990 levels, an accomplishment that relied heavily on building cleaner power plans.

But electricity accounts for only 16 percent of California’s emissions. Further reducing carbon discharges will require a significant reduction in vehicle emissions, which have inched up recently.

After signing the bill Monday, Brown also signed an executive order directing the state to achieve “carbon neutrality” by no later than 2045. After that, he says the state should emit net negative greenhouse gas emissions.

The order directs several state agencies to set targets for artificially removing carbon dioxide from the air through a process known as “sequestration.”