The Polish parliament rejected a controversial proposal calling for a near-total ban on abortion in a hastily arranged vote Thursday. The vote was preceded by mass demonstrations in which tens of thousands of people came out to the streets in different cities protesting the proposal supported by the Roman Catholic Church.

Polish lawmakers voted overwhelmingly to reject the bill by 352 votes to 58. The government said that the protests had given ministers “food for thought.” The ruling Law and Justice party (PiS) unexpectedly withdrew its support for the proposal Wednesday in an unscheduled parliamentary committee meeting after referring the same to the committee less than two weeks ago.

“PiS continues to back the protection of life,” party leader Jaroslaw Kaczynski reportedly told the parliament. “And it will continue to take action in this respect but it will be considered action.”

According to the Guardian, former Prime Minister Ewa Kopacz told reporters that the PiS had “backtracked because it was scared by all the women who hit the streets in protest.” This vote is the first major domestic setback for the ruling party which, according to opinion polls, is suffering its lowest ratings since coming to power a year ago.

Poland, whose citizens are mostly Catholic, has some of the strictest abortion laws in Europe. Abortions are allowed only in cases of rape, incest, or when the pregnancy poses a threat to the mother’s life or if the fetus is severely damaged.

The new proposal spearheaded by the Stop Abortion campaign group suggested tightening these laws further including cutting off access to abortion for women who became pregnant due to rape. It also called for a prison term of up to five years for women who sought abortions. The initiative drew 450,000 signatures in a country with a population of 38 million. Just before Thursday's vote, the Catholic Church said it opposed sending women to prison.

Many women feared that this proposal would lead to doctors hesitating to perform prenatal tests.