RICHMOND — Sweeping LGBT rights legislation that bans discrimination in employment, housing and public accommodations sailed out of the Virginia Senate and House on bipartisan votes Thursday.

Virginia would become the first Southern state to adopt such protections if the measures become law as expected. The bills also would for the first time apply Virginia’s civil rights protections to public accommodations such as restaurants and stores — not just for the LGBT community but also for racial minorities, women and religious groups.

The Senate and House bills have to cross over to the opposite chamber and win passage again before Gov. Ralph Northam (D), who requested the legislation, can sign them into law.

But those steps were seen as technicalities by advocates cheering what they regard as landmark human rights legislation.

“Its sends a message that the commonwealth is a safe and welcoming place for all people,” said Sen. Adam P. Ebbin (D-Alexandria), who was Virginia’s first openly gay legislator when he joined the House of Delegates in 2004.

Today, the General Assembly has a five-member LGBT Caucus, including Del. Danica A. Roem (D-Prince William), the first openly transgender state lawmaker elected in the country.

The Virginia Senate has passed a more limited version of the legislation — banning discrimination in housing and public employment — for several years. Previously, Republican House leaders always killed those measures in committee.

Both chambers are under Democratic control this year for the first time in decades. The LGBT rights measures are part of a flood of Democratic priorities advancing this year, including bills to limit access to firearms, boost the minimum wage and loosen voting rules.

The legislation that advanced Thursday would prohibit discrimination against LGBT people in employment, housing or public accommodations such as restaurants. It applies to public and private entities alike.

Alphonso David, president of the Human Rights Campaign, a national group that invested in Virginia legislative campaigns last year, said there are 30 U.S. states where “gay, lesbian, bisexual and transgender people can be fired from their jobs and discriminated against in housing. Today we take Virginia off that list.”

The public accommodations portion of the bill was especially notable because Virginia — the former capital of the Confederacy, which bitterly resisted racial desegregation — is one of just five states with no public accommodations law of any kind.

So the bills would not simply add LGBT people to an existing list of protected classes that cannot be denied service. Instead they would create an entirely new public accommodations provision, making it unlawful to deny services to individuals “on the basis of race, color, religion, national origin, sex, pregnancy, childbirth or related medical conditions, age, sexual orientation, gender identity, marital status, disability, or status as a veteran.”

“It’s long overdue,” House Speaker Eileen Filler-Corn (D-Fairfax) said in an interview ahead of the House’s 59-to-35 vote. “We need to end discrimination for our LGBTQ friends and family and co-workers. There’s nothing more important than that.”

The Senate’s bill passed 30 to 9, with nine of the chamber’s 19 Republicans voting in favor. Nine were against, and one GOP senator was off the floor when voting took place.

The measures make some exceptions for religious organizations, such as hiring by certain religious schools.

Sen. David R. Suetterlein (R-Roanoke), who in the past has supported bills banning ­anti-LGBT discrimination in housing and public employment, said he could not support this year’s more sweeping measure. He said religious rights could be threatened by including private employers and public accommodations.

“I’m happy to see fair housing and the state hiring provisions,” he said. “I just have concerns about the other provisions.”

In January, the Senate voted to ban conversion therapy on children, repeal the state’s now-defunct ban on same-sex marriage and establish statewide policies for the treatment of transgender students.

The chamber also voted to replace “husband and wife” with gender-neutral “parties to the marriage” language in divorce law and make it easier for transgender people to change how their sex is listed on their birth certificates.

With no debate and one Republican on board, the Senate voted Wednesday to allow “non-binary” Virginians to designate “X” on their driver’s licenses, instead of “M” or “F.”