New South Wales parliament has passed a bill decriminalising abortion, overturning a 119-year-old law and achieving what advocates say is a “massive step forward for women” in the state.

There was applause in the lower house as the Abortion Law Reform Act 2019 passed its final hurdle after more than 70 hours of debate in both houses and weeks of protest.

Abortions have already been decriminalised in Western Australia, Victoria, Tasmania, Queensland, the Northern Territory and the Australian Capital Territory, and are legal for some medical reasons in South Australia.

Labor MP Jo Haylen said parliament had affirmed that NSW trusted women to make decisions about their own bodies, on what was “a historic day”.

“This is about making sure women can make choices and that they can get a procedure which is health care,” she told reporters on Thursday.

“No longer will women be criminalised for making that choice and that’s a wonderful thing.”

The final vote came after the bill passed the upper house 26 votes to 14 on Wednesday night following nearly 40 hours of discussion - making it the third longest debate in the state’s house of review.

The bill, presented to parliament by independent MP Alex Greenwich, takes abortion out of the criminal code and allows terminations up to 22 weeks as well as later abortions if two doctors agree.

An amendment recognises that doctors performing late-term abortions can seek advice from a multi-disciplinary team, or hospital advisory committee.

The bill was opposed by religious groups, anti-abortion activists and several MPs who raised concerns about late-term and sex-selective abortions, conscientious objection and the way the bill was introduced.

Tensions reached a climax last week when Liberal MPs Tanya Davies, Matthew Mason-Cox and Lou Amato threatened, then withdrew, a leadership spill motion against Premier Gladys Berejiklian over her handling of the bill.

They said it had been made clear that “at an absolute minimum” four key amendments were required to ensure continued Liberal Party membership.

Davies on Thursday ultimately supported the upper house’s amendments to the bill, saying they created more safeguards for women, doctors and babies born alive after abortion.

“The process this bill went through was not as it should have but anyway, it is what it is and we are at a better place,” she said in parliament.

The premier was not present for the final vote on Thursday.

Greenwich had urged lower MPs to back the amended bill.

“None of the amendments that were put forward in the upper house in any way create new barriers for women to access safe and legal abortions in NSW,” he told reporters.

Labor MP Penny Sharpe, another co-sponsor of the bill, said it was “a massive step forward for women in NSW” and long overdue.

She said the bill would next need to be signed off by the governor “and once it’s signed, it on. That’s it. It’s done”.

But Sydney’s Catholic Archbishop Anthony Fisher described the vote as “a very dark day for NSW”.

“The new abortion law is a defeat for humanity,” he said in a statement.

“Since the abolition of capital punishment in New South Wales in 1955, this is the only deliberate killing ever legalised in our state.”