OKLAHOMA CITY (Reuters) - An Oklahoma bill that could send any doctor who performs an abortion to jail headed to the governor on Thursday, with opponents saying the measure is unconstitutional and promising a legal battle against the cash-strapped state if it is approved.

An oil drilling rig is seen near a parking lot in front of the state capitol building in Oklahoma City, Oklahoma U.S. March 9, 2016. REUTERS/Luc Cohen

The bill to make abortion a felony punishable by up to three years in prison was approved by the Republican-dominated Senate on Thursday. Governor Mary Fallin, a Republican opposed to abortion, has not indicated whether she will sign it.

The bill also calls on state medical boards to revoke licenses for the “performance of an abortion” but allows an exemption for abortion necessary to preserve the life of the mother.

“This is our proper function, to protect life,” Republican Nathan Dahm, an author of the bill, said during a debate. Supporters have said the bill could withstand a legal challenge because the state was within its rights to set licensing requirement for doctors.

Democratic Senator John Sparks said the bill would not stand up in court and would lead to expensive legal battles.

“This measure is harmful, discriminatory, clearly unconstitutional, and insulting to Oklahoma women and their families,” the Center for Reproductive Rights, an abortion rights group, said in a letter to Fallin.

Several abortion rights groups have promised a court fight if Fallin signs the bill, which they expect to happen as she has approved more than a dozen pieces of legislation restricting abortion since taking office in 2011. The state has been one of the leaders in adding restrictions to abortions.

Oklahoma City University constitutional law professor Andrew Spiropoulos said the bill, if approved, may be on shaky legal ground because the U.S. Supreme Court has ruled that abortion is legal in the United States.

“When there is a conflict between a state law and federal law, it is the federal law that prevails,” he said.

Lawmakers have faced criticism for not doing enough to plug a projected $1.3 billion state budget shortfall next year, which has caused Oklahoma to cut back on funding for schools and services.