Texas legislators overturned a temporary victory by state Democrats and standard bearer Sen. Wendy Davis, passing a bill late Friday that puts new restrictions on abortion procedures.

The bill passed the Republican-controlled Senate just before midnight, two weeks after the Legislature failed to put the restrictions to a successful vote in its first special session. The bill would ban most abortions past 20 weeks of pregnancy, place new requirements on which facilities could perform the procedures and limit a woman’s ability to induce an abortion by taking a pill.

Abortion rights advocates, including Planned Parenthood of Texas, have said that the new law would effectively shut down all but six of the facilities where abortions are performed in the state.

Pro- and anti-abortion activists flooded the Texas Capitol on Friday afternoon, setting the stage for a dramatic ideological showdown. Abortion rights advocates wearing orange were holding gynecological devices and signs, while anti-abortion advocates dressed in blue carried images of fetuses and Bible verses, according to The Associated Press.

Twenty-one amendments were offered, debated and rejected. As debate progressed, reporters inside the chamber said protesters could be heard chanting outside, and some protesters who were in the gallery were removed after outbursts.

As the time ticked toward midnight, senators offered passionate arguments on either side.

Gov. Rick Perry had made passing House Bill 2 a priority and said he will sign it into law.

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

Democrats in the legislature have said that while there was little they could do to keep the bill from passing, they plan to challenge it in federal court.

“We do not have the numbers to stop it,” said Democratic Sen. Royce West of Dallas, according to The Associated Press. “As soon as it’s signed by the governor, it will be challenged … we believe the whole bill is unconstitutional.”

Texas is only one of several states looking to tighten rules for abortions.

Lt. Governor David Dewhurst strikes the gavel as the Senate adjourns on July 11 in Austin, Texas.Eric Gay / AP

North Carolina's House passed a bill Thursday that directs state regulators to change standards for abortion clinics to bring them in line with more regulated outpatient surgical centers.

Missouri's governor Friday let a bill become law without his signature that requires doctors to be in the room for the initial dose of a drug used in medication abortions.

Wisconsin’s governor signed into law last week a measure similar to Texas' that forces abortion doctors to have admitting privileges at nearby hospitals. That law was blocked by a federal judge.

The biggest fireworks have come in Texas. Last month, GOP lawmakers were prevented from carrying out a vote on House Bill 2 as their first special session came to an end after Davis delivered an 11-hour filibuster that was cut short when state senators ruled she had committed three rules infractions. Raucous protests from Davis supporters in the gallery prevented lawmakers from carrying out a valid vote on the bill.

Security was tightened before the final vote Friday. Dozens of state troopers surrounded the gallery and monitored the hallways Friday, according to the AP.

Troopers inspected bags of people streaming into the halls of the capitol. Senate Sergeant-At-Arms Rick DeLeon said no props would be permitted in the gallery, including tampons, perfume bottles, and moisturizers, the AP reported.

Sen. Kirk Watson of Austin, the leader of the legislature’s Democrats, said he stepped in to prevent troopers from confiscating feminine hygiene products from women hoping to view the debate, according to the AP.

The fight over the bill has drawn national attention from abortion rights advocates disturbed by the spread of new restrictions, as well as anti-abortion activists who say the new law would protect the health of mothers and fetuses.

Former contender for the GOP presidential nomination Rick Santorum appeared in Austin on Thursday, and said that “Texas is the center of the pro-life debate in the country right now,” according to Reuters.