WARSAW, Poland — Polish lawmakers voted overwhelmingly on Thursday to reject a proposal by an anti-abortion group that would have imposed a total ban on abortion, giving in to massive outrage by women who have been dressing in black and waging street protests across the country.

The mostly Catholic nation already has one of the most restrictive abortion laws in Europe, with abortion only allowed in rare cases — rape or incest, when the mother’s life is in danger or the fetus is badly damaged.

The proposal for further tightening the law came from a citizens’ initiative that gathered some 450,000 signatures in this nation of 38 million. While supported by some conservative Catholics, it was highly unpopular with most Poles, with people balking at the idea that a teenage rape victim should be forced to have her baby, or that a woman whose health was badly compromised would be forced to carry to term.

The proposal had also called for prison terms of up to five years for women who sought abortions.

With abortion already illegal in most cases, many women said what frightened them the most in the proposal was that it could have led doctors to be afraid to perform prenatal tests or that women who suffered miscarriages could start to fall under criminal suspicion.

Initially many members of the conservative ruling party, Law and Justice, supported the proposal. Two weeks ago a majority of lawmakers voted to consider it, sending it to a commission for further study. But the party backed away from it under massive social pressure, and lawmakers voted against it 352-58.

“We are dealing here with a giant misunderstanding,” said party leader Jaroslaw Kaczynski, the power behind the government. “We have the utmost respect for those who signed the proposal (for the abortion ban). But we have come to the conclusion, observing the social situation, that this would be a factor leading to protests.”

The outcome of the vote is a blow to the ruling party, which has a core of ultra-conservative Catholic voters that wanted to see further restrictions to the abortion law. But the party also came to power thanks to centrist voters and young people who were attracted by the party’s welfare program, with its promises to help the poor and even out the vast economic differences of the post-communist era.

Many in that latter group have been taking to the streets in recent days, and opinion polls show that the party’s support has now fallen to its lowest point since it won elections a year ago.

Now the party finds itself on the defensive after angering groups on all sides — women, its traditional opposition, moderates among its own electorate and religious conservatives.

Mariusz Dzierzawski, from the Stop Abortion committee, accused the ruling party leadership of “hypocrisy” for turning its back on his group’s proposal.

Prime Minister Beata Szydlo vowed that the government will now take other steps to protect human life. She announced a new plan to earmark more money from the budget for families with disabled children and said it would begin an information campaign that would “promote the protection of life.”

The Catholic church also tried to distance itself from the measure. Priests and bishops had held Masses in its support on Monday, but on Thursday the bishops’ conference released a statement saying that it backs all measures that support the “full protection of life from conception to natural death, but does not support a project which imposes criminal punishment on women who have an abortion.”