After weeks of dramatic debate, Texas senators voted shortly after midnight Saturday morning to pass a bill limiting abortion to 20 weeks of pregnancy, among other restrictions.

The bill would effectively shut down all but six abortion clinics in the state, Planned Parenthood of Texas and other abortion rights groups said. Aside from restricting abortions to before 20 weeks of pregnancy, the measure would place further restrictions on abortion providers and whether a woman may take a pill to induce abortion.

Other state legislatures, and even the House of Representatives, have passed bills to restrict access to the first 20 weeks of pregnancy. These restrictions have been challenged and struck down in courts, because Roe vs. Wade ensures access to abortions up to 24 weeks. Other provisions in the bill, many of which impose tighter regulations on abortion clinics, are more legally questionable.

Proponents and opponents of the bill gathered in the Texas Capitol on Friday afternoon, as if for a sporting contest — pro-choicers donning orange shirts supporting one side, with blue-shirted pro-lifers on the other.

In a dramatic end to two weeks of rancorous debate, lawmakers offered amendments for debate as protesters chanted outside and some were removed from the gallery by police. Late into the night, senators on both sides delivered impassioned speeches.

Republican Gov. Rick Perry will soon sign the bill into law — a swan song following his decision not to run for re-election next year.

"This legislation builds on the strong and unwavering commitment we have made to defend life and protect women's health," Perry said in a statement. "I am proud of our lawmakers, and citizens who tirelessly defended our smallest and most vulnerable Texans and future Texans."

Although Democrats lacked the power in the legislature to stop the bill, they plan to challenge the law in federal court.

"We do not have the numbers to stop it," Sen. Royce West, a democrat of Dallas, told reporters. "As soon as it's signed by the governor, it will be challenged. We believe the whole bill is unconstitutional."

Texas is one of many states seeking to restrict abortions.

On Thursday, lawmakers in North Carolina's House passed a bill to raise standards for abortion clinics to those of outpatient surgical centers. In Missouri, lawmakers passed a new law to require physicians to preside over the administration of the initial dose of a drug used in medication abortions, and a new law in Wisconsin requiring abortion doctors to secure nearby hospital admitting privileges was blocked by a federal judge.

However, Texas remains "the center of the pro-life debate in the country right now," former Republican presidential candidate Rick Santorum told reporters on Thursday.