SANTIAGO (Reuters) - A Chilean court on Monday ruled that a law legalizing abortion in certain cases is constitutional, a win for President Michelle Bachelet’s center-left coalition and for groups that have campaigned for years against the country’s strict ban.

With the decision by Chile’s Constitutional Court, women in the South American nation will be allowed to seek an abortion when their life is in danger, when a fetus is unviable or when a pregnancy results from rape.

Chile was one of only a handful of countries worldwide where abortion was illegal without exception. The ban was put in place during the closing days of Augusto Pinochet’s 1973-1990 dictatorship, and Bachelet introduced a bill to loosen the prohibition soon after taking office for a second time in 2014.

The road to congressional approval was difficult and met multiple delays due to deep divisions in the governing coalition and a unified opposition.

The abortion bill was passed in its final form earlier in August, but conservative legislators then challenged its constitutionality.

After listening to over 130 organizations over several days, the Constitutional Court rejected that challenge largely along partisan lines, meaning the bill now becomes law. Following the decision, women’s’ rights groups as well as left-leaning and centrist political parties celebrated outside the court in downtown Santiago.

“What this decision definitively does is take Chile once and for all off the embarrassing list of countries that still criminalize abortion without exception,” said Ana Piquer, the executive director of Amnesty International Chile.