Sweden has committed to becoming a net-zero carbon emitter by 2045, under a law passed in parliament on Thursday.

Lawmakers voted 254 to 41 in favour of the proposal, which was developed by a committee involving seven out of eight parliamentary parties. Only the far right Swedish Democrats did not engage in the consultation.

The legislation, which takes effect from 1 January 2018, takes a similar form to the UK’s 2008 Climate Change Act. It establishes an independent Climate Policy Council and four-yearly cycle for updating the national climate action plan.

“For Sweden to be able to continue to take the lead in the transition to a climate-smart society we need a long-term and stable climate policy,” said Green Party climate spokeswoman Stina Bergstrom. “We’ve finally got that now.”

New Sweden #Climate#Law just passed Parliament 254 Yes vs 41 No. So went through with an 86% majority. Hurray for #klimatlag !!!

Sweden’s deputy prime minister Isabella Lovin caused a stir in February when she publicised the bill with an all-female photo. The image was widely interpreted as a dig at Trump, parodying the all-male team at his side when he signed an executive order to slash funding for abortion services worldwide.

She later insisted it was a coincidence, but sources present at the time of the photo confirmed to Climate Home that it was not.

Gareth Redmond-King, head of climate and energy at WWF, welcomed the outcome. “Today is an important victory, not only for Sweden, but for everyone who cares about the future of our environment,” he said.

“With Donald Trump planning to pull out of the Paris Agreement, now more than ever do we need the rest of the world to up its game in combating climate change. The only way to achieve our climate goals is to embrace the opportunities presented to us by renewables and the technologies that support their deployment.”

Sweden already gets the bulk of its power from hydro dams and nuclear, so its climate policy is focused on greening transport with biofuels and electricity. This autumn’s budget is expected to confirm a sectoral target to cut transport emissions 70% from 2010 levels by 2030.