The move to decriminalise brings Australia’s most populous state in line with the rest of the country.

Abortion has been decriminalised in Australia‘s most populous state of New South Wales after weeks of contentious debate, bringing its laws into line with the rest of the country.

Politicians from across the political spectrum voted on Thursday to overturn the laws that date back to 1900 and had left women and their doctors at risk of prosecution and a prison term of up to 10 years if an abortion was deemed “unlawful”.

The legislation was delayed for months by a small group of conservatives from the ruling Liberal Party who rebelled against their leader.

The passage of the bill was cheered by pro-abortion rights advocates, who had staged several large demonstrations in its support in recent months, countered by similarly passionate anti-abortion rights rallies.

Alex Greenwich, the independent representative for Sydney who introduced the bill, said he was sorry it had taken so long for abortion to be removed from the criminal code.

“My deepest gratitude goes to my parliamentary colleagues and to the dedicated women’s rights campaigners who have fought toward this for decades,” he said in a statement.

Amendments forced

Though prosecutions were rare, the procedure was only considered legal if the doctor believed the woman’s physical or mental health was in danger.

The new legislation allows abortions to be performed by a doctor on request up to 22 weeks. After that, the consent of two doctors is required.

The law also makes it illegal for an unqualified person to perform an abortion, with the offence punishable by up to seven years in jail.

Amendments made to appease the bill’s conservative opponents included tighter regulations on late-term abortions and mandated medical care for any baby born alive following a termination procedure.

New South Wales last year introduced “safe access zones” around medical clinics and hospitals that provide terminations, to stop anti-abortion rights protesters from harassing women.