AUSTIN — Gov. Greg Abbott has signed the state's sanctuary city ban into law, achieving one of his major goals for the legislative session and enacting a bill that is almost certainly headed for legal challenges from opponents.

"Texans expect us to keep them safe, and that is exactly what we are going to do by me signing this law," Abbott said before inking his signature during a Facebook Live video Sunday night -- the first time a Texas governor has signed a bill through an Internet live stream.

Abbott, who designated the ban as an emergency item in January, signed the bill just four days after both chambers of the Legislature gave it final approval. Its passage is a major victory for Abbott and Republicans who advocate for stricter enforcement of immigration law. The Legislature has tried to pass a ban every session since 2011.

The law will go into effect Sept. 1.

Opponents of the law were quick to condemn the signing. Thomas Saenz, president of the Mexican American Legal Defense and Educational Fund, said that the law was a "colossal blunder" and that the lawmakers who championed it were small-hearted.

"MALDEF will do its level best, in court and out, to restore Texas, the state where MALDEF was founded, to its greater glory, and to help Texas to overcome 'Abbott's Folly,' " he said in a written statement.

{"type":"video","title":"Dallas News Video","author_name":"Dallas News","_id":"M1c3I0YjE6IxZy1ZDJCqULiH2-vUdfU0","provider_name":"Ooyala","html":"

","raw":"{\"type\":\"video\",\"title\":\"Dallas News Video\",\"author_name\":\"Dallas News\",\"_id\":\"M1c3I0YjE6IxZy1ZDJCqULiH2-vUdfU0\",\"provider_name\":\"Ooyala\",\"html\":\"\\u003Cdiv class=\\\"oo-vid-container\\\" data-oo-content-id=\\\"M1c3I0YjE6IxZy1ZDJCqULiH2-vUdfU0\\\"\\u003E\\u003C\\/div\\u003E\\u003Cscript defer src=\\\"https:\\/\\/www.dallasnews.com\\/resources\\/motif\\/dist\\/js\\/ooyala.js\\\"\\u003E\\u003C\\/script\\u003E\"}","providerType":"ooyala","providerLink":"https://www.dallasnews.com/oembed","embedType":"video"}

Saenz said the law would alienate "nearly half the state population" and make people subject to widespread racial profiling. He said the law undermines voters' rights to choose elected officials who set local policy, makes the job of local law enforcement more difficult by straining relationships with immigrant communities and would cost Texas in trade and tourism, as well as legal challenges.

"This racist and wrongheaded piece of legislation ignores our values, imperils our communities and sullies our reputation as a free and welcoming state," Terri Burke, executive director of the ACLU of Texas said in a prepared statement. "We will fight this assault in the courts, at the ballot box, and in the streets if we have to."

The law will ban cities, counties and universities from prohibiting their local law enforcement officers from asking about immigration status and enforcing immigration law. It will create a criminal charge for police chiefs, county sheriffs and constables who violate the ban and will charge local jurisdictions up to $25,000 for each day they are in violation.

The law will also allow police officers to ask about a person's immigration status during any legal detention, which could include a routine traffic stop. Opponents have likened the law to Arizona's "papers, please" legislation, parts of which were struck down by the U.S. Supreme Court.

Elected or appointed officials who violate the ban could be removed from office -- another portion of the law that is likely to face legal challenges.

Abbott addressed possible challenges in his roughly five-minute Facebook Live signing, saying the key provisions in the bill have been tested at the U.S. Supreme Court and approved.

"It simply makes sense," he said. "Citizens expect law enforcement officers to enforce the law, and citizens deserve lawbreakers to face legal consequences."

Proponents of the ban say it is necessary to keep criminal immigrants off Texas streets. If local law enforcement officials don't turn over unauthorized immigrants to federal authorities, they argue, those people could go on to commit more serious crimes.

Opponents of the law took Abbott to task for signing the bill on a Sunday and away from press and public scrutiny.

"It seems fitting that Greg Abbott would sign this disgraceful bill on the Internet on a Sunday night, far from the press and the public," Bob Libal, executive director of Grassroots Leadership, said in a written statement.

Rep. Rafael Anchia, D-Dallas, said in a tweet in Spanish that Abbott had "no shame" signing the bill on a Sunday, the day of worship for a majority of Latinos who are Christian.

"He's Catholic but after mass he signed an anti-immigrant law, SB 4, which has been criticized by the Texas Conference of Catholic Bishops" he said in his tweet.

The Texas Conference of Catholic Bishops, whose support Abbott often cites on issues like abortion, had strongly opposed the law. On Friday, the bishops had called on Abbott to veto the bill.

Matt Hirsch, an Abbott spokesman, tweeted Sunday night that his office chose to broadcast the signing on Facebook Live to reach a wider audience. An hour after the signing, the video had been viewed more than 400,000 times.

For those wondering why we chose Facebook live. And it's only been an hour. pic.twitter.com/IdkHm7Mf45 — Matt Hirsch (@MattJHirsch) May 8, 2017

During the signing, Abbott criticized the policies of Travis County Sheriff Sally Hernandez, who earlier this year changed policies to limit the unauthorized immigrants her office would turn over to federal immigration authorities under requests called "detainers."

"Those policies are sanctuary city policies and won't be tolerated in Texas," Abbott said."Elected officials and law enforcement agencies, they don't get to pick and choose which laws they will obey."

Abbott said ignoring requests for cooperation from federal immigration authorities has had "deadly consequences," pointing to the death of Katie Steinle in San Francisco as an example. Steinle was killed in 2015 by an unauthorized immigrant who had a criminal record.

After signing the bill, Abbott proclaimed: "Texas has now banned sanctuary cities in the Lone Star State. ... The reason why so many people come to America is because we are a nation of laws, and Texas is doing its part to keep it that way."

By 7 p.m., protesters had started gathering at the Governor's Mansion to object to the bill signing.

"With SB 4, Texas Republicans have cemented their reputation among generations of young Latinos and people of color to come," Sheridan Aguirre, a member of the immigrant youth network United We Dream, said in a written statement. "We've made up our minds -- we will not be silenced and we will remember who terrorized our families."