A bill to legalize abortion has been approved by the Spanish lawmakers on Thursday, with 184 of the 350 members of the lower chamber voting in favor of the bill.

The Roman Catholic Church and the right-wing Popular Party from the opposition have been opposing the bill, which will now be presented before the upper-house senate and come back to the parliament for the final go-ahead.

The Socialist government had brought this bill to the table, which will allow abortions up to the 14th week of pregnancy, and if the mother’s health is under risk or there are serious problems to the fetus, abortions would be allowed up to 22 weeks. Most of Spain’s partners in the EU have similar laws on abortion.

However, a controversial reform, which would have allowed girls aged 16 to undergo abortion without the consent of their parents, has been dropped. Young girls would now have to apprise their families of the decision to end pregnancy, except in cases where there is “a clear risk of family violence, threats, pressure or mistreatment.”

As per the current law, abortion is permitted only when it is a rape case, malformation of the fetus or when the pregnancy, if allowed to go full term, poses risk to the pregnant woman’s mental or physical health.

The Church had warned the government prior to the vote that abortion was a crime and that anyone who supported the new abortion bill would be committing a sinful act.