Image caption Supporters of the bill (wearing blue) and opponents (wearing orange) packed the Senate gallery as debate began

Texas legislators have passed a contentious bill banning abortions after 20 weeks of pregnancy.

The legislation, which was debated in the state Senate after passing in the House, will also shut down most of the state's abortion clinics.

Republicans had moved quickly to pass the bill after a Democratic senator originally blocked it with a marathon delaying speech.

Governor Rick Perry has vowed to sign the bill into law amid large protests.

The Texas legislation mirrors a series of state laws recently passed in Mississippi, Ohio, Oklahoma, Alabama, Kansas, Wisconsin and Arizona.

The US Supreme Court legalised abortion nationwide in 1973, but about a dozen states have enacted laws in recent years limiting access to the procedure. Some of that state legislation is tied up in court battles.

Filibuster block

The bill came near to passage last month but was blocked in the state Senate when Senator Wendy Davis spoke for nearly 11 hours - in a delaying speech known as a filibuster - in an attempt to run out the clock on the legislative session.

The following day, Mr Perry, a Republican who opposes abortion, called a special session to take up the abortion bill and other legislation.

There will be lawsuits, I promise you State Senator Rodney West, Democrat

The filibuster drew nationwide attention and made Ms Davis a heroine of the US abortion rights movement.

Anti-abortion and abortion rights protesters have rallied at the state capitol in Austin in large numbers since the second special session began.

In addition to banning abortions after 20 weeks of pregnancy, the bill will require all abortion procedures to be performed at a surgical centre, and mandate all doctors performing abortions have admitting privileges at a hospital within 30 miles (48km) of the clinic.

Only six abortion clinics in Texas can be classified as surgical centres, and all are in major metropolitan areas, according to the Texas Tribune. Critics say the provision will force some women to travel hundreds of miles to have an abortion, while supporters say it will protect women's health and the foetus.

The bill's sponsor, Senator Glenn Hegar, argued during debate on Friday that all abortions, including those that are medically induced, should take place at a surgical centre in case of complications.

Democrats argued childbirth is more dangerous than abortion and abortion drugs do not pose such a risk. They had planned to introduce numerous amendments to the bill, including exceptions for rape and incest.

Image caption A lengthy line formed to hear the Senate debate on Friday

Senator Rodney West, a Democrat, also questioned why Republicans wanted to pass restrictions similar to those currently tied up in legal challenges.

"There will be lawsuits, I promise you," said Sen West, raising his right hand as if taking an oath.

Among the bill's opponents were the Texas Medical Association, the Texas Hospital Association and the American College of Obstetrics and Gynecology.

When asked about why he was sponsoring a bill that medical experts did not support, Sen Hegar said he had heard from "numerous experts and doctors" who supported the restrictions.

"And what do we do if they are right and we don't pass this legislation?" he said.

Another senator, Bob Deuell, a Republican and a doctor, defended the bill, saying abortion clinics in the state "had not maintained the proper standard of care".

Tampons pulled

In testimony earlier before a House committee, lawmakers heard personal stories from both sides. Some women said they had regretted having an abortion, while others said it had given them a second chance.

Media playback is unsupported on your device Media caption Senator Wendy Davis spoke for 10 hours

On Friday, officers thoroughly checked the bags of people entering the gallery after Texas police said they had information that "individuals planned to use a variety of items or props to disrupt legislative proceedings at the Texas Capitol".

In a statement, police said they had confiscated "significant quantities of feminine hygiene products, glitter and confetti possessed by individuals" as well as "one jar suspected to contain urine, 18 jars suspected to contain faeces, and three bottles suspected to contain paint".

Abortion rights advocates on Twitter pointed out that concealed firearms, however, are allowed inside Texas' state capitol.

Each spectator was also given a copy of the capitol's rules of decorum, which stipulate there can be no demonstrations or attempts to disrupt the chamber's work.

In a dramatic conclusion to Sen Davis' filibuster last month, protesters chanted in the gallery after she was ruled to have gone off topic. Democratic senators took up the rest of the time before the midnight deadline with procedural challenges.