The Senate on Monday defeated a bill to ban abortion after 20 weeks of pregnancy.

The result was expected because the bill needed 60 votes in favor of ending debate, which would have set up a vote to pass it. But even with all 51 Republicans in support, the bill needed nine Democrats, and those votes weren't there — the bill fell in a 51-46 vote.

Republican Sens. Susan Collins of Maine and Lisa Murkowski of Alaska joined all but three Democrats in voting against the bill. Democrats voting for the bill were Sens. Joe Manchin of West Virginia, Bob Casey of Pennsylvania and Joe Donnelly of Indiana.

President Trump said in a statement Monday night that "it is disappointing" that the bill was rejected. "We must defend those who cannot defend themselves. I urge the Senate to reconsider its decision and pass legislation that will celebrate, cherish, and protect life."

Trump had said during a speech broadcast at the March for Life rally on Jan. 19 that he wanted Congress to send the anti-abortion bill to his desk to sign into law. The House passed its own version of the legislation last year.

Anti-abortion groups aimed to get senators on the record regarding the issue ahead of the midterm elections. They pressed for a vote close to the rally, which protests the Supreme Court's Roe v. Wade decision that made abortion legal nationwide.

The bill would have made it a crime for doctors to perform abortions after 20 weeks of gestation. Under the bill, those who break the law would face a fine, up to five years in prison, or both. The legislation contained exemptions in cases of rape, incest and a pregnant woman's life. It did not contain exemptions for fetal abnormalities.

Proponents of the legislation, the Pain Capable Unborn Child Protection Act, say that a fetus can feel pain at 20 weeks, but opponents argue with that assessment and say that women who have abortions late in a pregnancy tend to be faced with test results that reveal when a baby is born it with die or face lifelong disabilities.

Ahead of the vote, Sen. Patty Murray, D-Wash., called the ban "extreme" and "ideological" on the Senate floor.

“It goes against the Constitution, against medical experts, and against the rights of women across the country," she said.

"I oppose the fact that we are still voting on whether women and doctors are best equipped to make healthcare decisions, or politicians here in D.C. We are still voting on whether we should criminalize doctors for making sound medical decisions. We are still voting on whether we should turn back the clock and put women’s lives at risk," Murray said.

Sen. Elizabeth Warren, D-Mass., accused Republicans of wanting to "score political points at the expense of women and their families."

"This unconstitutional bill would put women's health and women's lives at risk," she said.

Republicans who spoke on the Senate floor emphasized that the practice is banned in all but six other countries: China, Singapore, North Korea, Vietnam, Canada, and the Netherlands.

Senate Majority Leader Mitch McConnell said the bill reflected "a growing mainstream consensus that unborn children should not be subjected to elective abortions after 20 weeks."

"It is long past time that we heed both science and common-sense morality and remove ourselves from this very undistinguished list," he said of the countries that allow abortions later in a pregnancy.

Sen. Thom Tillis, R-N.C., echoed similar sentiments.

"I think this is balanced policy and something I hope my colleagues will support," he said.

At least 20 states ban abortion after 20 weeks, and less than 1 percent of abortions occur during this time in a pregnancy. The bill passed the House in October.

After the vote, Collins said she was opposed to late-term abortions and would support legislation to ban them except in rare circumstances, calling the latest bill "well-meaning but flawed." The bill, she said, severely restricts the exception for rape and incest when a minor is involved.

She explained also that the bill did not contain exemptions for medical emergencies, such as when a pregnant woman is at risk of physical harm, like cancer, uterine rupture, non-Hodgkin's lymphoma, or preeclampsia, which often develops after the 20th week of a pregnancy and can lead to liver and kidney problems, seizures and strokes.

“Almost every country in Europe that limits late-term abortions allows for exceptions for the physical health of the woman," she said. "Like these European countries, states ... provide an exception for the physical health as well as the life of the woman."

Murkowski echoed similar reasons for voting against the bill, saying that she opposes late-term abortion and could support legislation with sufficient exemptions and protections.

“I firmly believe that there should be clear and workable exceptions, particularly for victims of rape and incest and in cases where the life or physical health of the mother is threatened​," she said. ​"For example, requiring a teenage girl who was raped by her father to report to law enforcement or a government agency prior to obtaining an abortion simply is not workable​." ​

Sen. Lindsey Graham, R-S.C., the lead sponsor of the bill, said he wants to try again.

“We will be back,” he said. “Twenty states have passed a version of it. The more the public understands about what we are trying to do the better off we will be.”

Anti-abortion groups called the failed vote a "disgrace."

"It is a disgrace that our Senate has once again failed to pass a bill that reflects the hearts and minds of the national pro-life consensus," said Jeanne Mancini, president of March for Life.

Anti-abortion groups have said they plan to target red-state Democratic senators who voted against the ban, especially those up for re-election in 2018.

Sen. Claire McCaskill, D-Mo., who voted no and is up for re-election in the fall in a state Trump won by 19 percentage points, said that she wasn't concerned about the attacks.

"Every time I run they target me," McCaskill said, referring to anti-abortion groups.

Sen. Doug Jones, D-Ala., said before the vote that he planned to vote against the ban. Jones won a special election in Alabama by a slim margin in December over accused child molester Roy Moore.

"I think there are serious constitutional problems with it," he said of the 20-week ban.