SYDNEY, Australia — State lawmakers in Queensland voted on Wednesday to decriminalize abortion, scrapping a century-old law that had made it an offense punishable with prison time and making it the latest Australian state to loosen its restrictions.

The effort prevailed after activists had tried and failed for decades to gain the traction needed to overturn the law in a state known for entrenched conservatism. This time, the legislation was able to move forward after the leader of the opposition party allowed its members to vote their conscience, rather than follow party guidance. Several of its members voted in favor of the legislation.

It also comes at a time when the Queensland Parliament has achieved a notable level of representation for women: The premier, the head of the government, is a woman, the first in Australia to be elected to two terms. Her deputy is a woman, and so is half of her cabinet. And, in another first, the opposition is also led by a woman.