California just made a big step in the fight against climate change. In a landmark bill, California's lawmakers voted to get 100 percent of the state's electricity from clean energy sources by 2045. In a vote 43-32 in favor of the legislation, the mandate would require all electricity to come from solar, wind, geothermal, ocean waves, and other renewable energy sources.

“This is landmark legislation that is helping to stave off some of the worst effects of climate change,” said Dan Jacobson, state director for Environment California, an environmental advocacy group. “We need it more than ever because the state and the world are starting to see the devastating impacts of climate change.”

According to Bloomberg, the state currently gets about 44 percent of its power from renewables and hydropower. The state has reduced its emissions to their lowest level since 1990, hitting the 2020 targets four years early. Beating its initial clean energy goal is roughly the equivalent of taking 12 million cars off the road.

Image: Bloomberg

“It’s already happening for economic reasons,” Pavel Molchanov, an analyst at Raymond James Financial Inc., told Bloomberg. He also noted that solar and wind are the cheapest sources of electricity in some regions. “I think California can get to 100 percent in 15 years.”

The SB100 bill would speed up California's move towards going all renewable; the state will now aim to hit 50 percent renewable electricity by 2026, and 60 percent by 2030–and then targets 100% carbon-free production in 27 years.

“What is really important is now that we have a goal, this will unleash the creativity of all the folks who are designing the endgame for fossil fuels,” Bruce Nilles, a senior fellow at the nonprofit Rocky Mountain Institute, told Fast Company. “Setting the goal has just been, over and over again, so very important. Because then that sends a very clear message to investors, to entrepreneurs, to our research facilities: Okay, let’s get it done. Let’s do it in the cleanest, cheapest, most equitable way possible.”

The legislation comes after California has made a series of moves to aggressively tackle climate change's impact on the state. Earlier this year the Golden State became the first in the U.S. to require solar panels on all new homes beginning in 2020. Last month lawmakers introduced a bill that would make California the first state to restrict the use of plastic straws in restaurants. One study by UC Davis researchers found that 25 percent of the fish from markets in California and Indonesia contained plastic debris.

“The world is watching as California sets the way forward,” Alex Jackson, a senior attorney with the National Resources Defense Council, told the AP.