Alabama has passed a sweeping bill to crack down on illegal immigrants that both supporters and opponents call the toughest of its kind in the country, going well beyond a law Arizona passed last year that caused a furor there.

The measure was passed by large margins in the Alabama Senate and the House, both Republican-controlled, in votes on Thursday. Governor Robert Bentley, a Republican, is expected to sign the bill into law.

“Alabama is now the new No. 1 state for immigration enforcement,” said Kris Kobach, a constitutional lawyer who is secretary of state in Kansas. He has helped write many state bills to curtail illegal immigration, including Alabama’s.

“This bill invites discrimination into every aspect of the lives of people in Alabama,” said Cecillia Wang, director of the immigrants’ rights project of the American Civil Liberties Union, which has brought legal challenges against several state immigration-control laws. Calling Alabama’s bill “outrageous and blatantly unconstitutional,” Ms. Wang said, “We will take action if the governor signs it.”