The House passed legislation Friday to amend the decades-old Civil Rights Act to ban discrimination based on sexual orientation and gender identity.

Despite a sea change in the past decade in public opinion regarding gay rights and the legalization of same-sex marriage nationally, 30 states have no laws protecting people from being fired, denied housing or harassed for their sexuality or gender identity. The bill would prohibit such discrimination in education, jury duty and federal financing along with housing and employment.

“The ability to have a job, to receive medical care or to rent a home should not depend on who someone is,” Judiciary Committee Chairman Jerrold Nadler (D-N.Y.) said during House debate. “We cannot accept the situation where anyone in this country can get married on Sunday and legally fired on Monday because of who they love.”

Rep. David N. Cicilline, D-R.I., was chief sponsor of the measure to amend the 1964 law, calling it “a life-saving bill that addresses some of the fundamental inequality.”

As Democrats applauded, the bill passed 236-to-173, with eight Republicans breaking ranks and joining all Democrats in backing the measure. It is unlikely to get a vote in the Republican-led Senate, and the White House has signaled that President Trump would veto the measure if it ever reached his desk.

Several Republicans spoke in opposition to the legislation, arguing that it violates religious freedom and nullifies women’s rights, particularly in the area of competitive sports.

“It is bad for freedom to force small business owners all across this country to provide services or products to the public that may violate their deeply held faith-based convictions,” said Rep. Ross Spano (R-Fla). “Again, allowing the state to essentially impose from above top down its own moral codes and rules in place of those of the individual.”

Many Republicans also warned that if the bill became law, men who identify as women would take spots on women’s sports teams or get their scholarships.

Rep. James Comer (R-Ky.) said the law would “subvert the purpose of gender division by allowing men to compete against girls.”

He said the legislation had “a clever name,” but was a “vehicle for harmful consequences.”

Rep. Louie Gohmert (R-Tex.) said Democrats were making bad laws just to protect the feelings of “people who are gender confused or suffering gender dysphoria, the opposite of euphoria.”

