The House on Tuesday passed a bill to ban abortion after 20 weeks.

The bill, the Pain-Capable Unborn Child Protection Act, would penalize medical providers who perform abortions after 20 weeks of gestation with up to five years in prison or fines, or both. The bill contains limited exceptions, including when a woman's pregnancy puts her life at risk and in cases of rape or incest.

The legislation, which passed 237-189, has support from President Trump, who said in a statement of administration policy Monday that if it were to reach his desk his team would recommend he sign it into law.

The bill, however, is likely to be defeated in the Senate, as it needs 60 votes for passage but Republicans hold only 52 seats. A similar piece of legislation met the same fate in 2015.

Before the House vote, Rep. Trent Franks, R-Ariz., the bill's sponsor, told the Washington Examiner that he thought it was time for the Senate to get rid of the legislative filibuster.

"There is a growing recognition that Democrats intend to change the rule as soon as they are in full power again anyways," Franks said. He pointed to the confirmation of Supreme Court Justice Neil Gorsuch as evidence that senators are open to changing it, as that confirmation required Senate Majority Leader Mitch McConnell, R-Ky., to nuke the filibuster on Supreme Court nominees.

"Those who said they would never change the rule voted to a person to do exactly that," Franks said. "I think the senators are realizing that this rule has protected them from a long time from taking tough votes. The American people have had it way up to here on a gridlocked government that can't address the issues of consequence that face this country."

States have different restrictions on abortions, with 17 of them banning abortion at about 20 weeks post-fertilization, according to the Guttmacher Institute, which tracks and studies reproductive laws. Advocates of 20-week bans say a fetus can feel pain at this stage.

Abortion rights groups have countered that the majority of abortions occur before 21 weeks and women who have an abortion later in a pregnancy are often faced with genetic results that indicate if a child is born he or she will be disabled or will not survive.

"The agenda behind this bill is clear: to shame women and to ban safe, legal abortion," said Dana Singiser, vice president for government relations and public policy for Planned Parenthood Federation of America. "It is unbelievable that politicians in Congress are once again attempting to interfere in a woman's ability to make personal decisions about her pregnancy in consultation with her doctor and others she trusts."

During floor debate on the bill, several Republicans argued in favor of the legislation, saying that some babies are born premature and close to that point in the gestation period. They stressed that they believed a fetus could feel pain at 20 weeks.

"We must not turn away from the pain of the most vulnerable among us," House Speaker Paul Ryan, R-Wis., imploring his colleagues to vote for the bill.

Democrats countered that abortions after 20 weeks occur only in limited circumstances in which families must make painful decisions. Rep. John Conyers, D-N.Y., called the legislation "dangerous" and "mean-spirited," saying it did not trust women to make their own decisions, and Rep. Pramila Jayapal, D-Wash., said that women who face the possibility of giving birth to babies with severe physical abnormalities in which a baby was unlikely to survive should be able to receive an abortion if they choose.

During the start of debate, Democrats called attention to how the House was voting on abortion rights rather than on gun restrictions after the mass shooting in Las Vegas Sunday night, in which at least 59 people were killed and more than 500 others were wounded.

Earlier Tuesday, House Republicans distanced themselves from legislation that would lift taxes and regulations on gun suppressors, expand access to hunting and sports shooting, and remove suppressors from the scope of the National Firearms Act of 1934.

The future of that legislation is uncertain. The measure cleared a House committee last month and was on deck for possible consideration, but Republicans have not scheduled a vote for it.

• Robert King contributed to this report.