A Virginia legislator has filed a bill to regulate transgender people’s use of restrooms in schools, at highway rest stops and in other government buildings — a proposal akin to a controversial North Carolina law.

The legislation from Del. Robert G. Marshall (R-Prince William) goes further than the North Carolina measure in one regard: It requires school principals to notify a parent if a student asks to be treated as a member of the opposite sex — whether by being allowed to use a different bathroom or being addressed by a different name or pronoun.

Marshall said his Physical Privacy Act addresses a pressing social concern about student safety — one that, he noted, drew hundreds of parents to school board meetings on the subject in Prince William and Fairfax counties. He expressed fear that men and boys will pretend to be transgender to infiltrate bathrooms and locker rooms used by women and girls.

“Some guys will use anything to make a move on some teenage girls or women,” he said. “Mere separation of the sexes should not be considered discrimination.”

The bill does not prohibit a government entity from providing “an accommodation, including the use of a single-occupancy restroom.”

The proposal drew immediate condemnation from legislators and organizations supportive of gay, lesbian and transgender rights, with Equality Virginia calling it “hateful and discriminatory.” Few predicted it would pass into law.

Even Marshall said leaders of his own party are unlikely to embrace the bill given its potential to turn off moderate Republican and independent voters ahead of this year’s elections for governor, lieutenant governor and attorney general.

“My intuition, based on experience, is the speaker’s going to want to duck this,” Marshall said, referring to House Speaker William J. Howell (R-Stafford).

A spokesman for Howell, Christopher E. West, was highly dismissive. “That’s just Bob being Bob,” West said. “He knows the House doesn’t operate that way.”

Even if the bill passed the GOP-controlled General Assembly, Gov. Terry McAuliffe (D) would veto it.

“Governor McAuliffe has been clear that he will veto any bill that restricts the rights of Virginians based on sexual orientation or gender identity,” McAuliffe spokesman Brian Coy said in a written statement. “As we saw in North Carolina, these bills don’t just hamper civil rights — they kill jobs. The Governor is hopeful that Republicans in the General Assembly will drop these counterproductive bills and turn their focus toward building a stronger and more equal Virginia economy.”

Marshall’s proposal drew praise from the conservative Virginia First Foundation. The group issued a written statement from board member Travis Witt, the pastor of Gilboa Christian Church in rural Mineral and the former chairman of the Virginia Tea Party Patriots Federation.

“Public school facilities are not the place for social experiments that permit early exposure to sexual issues when there is ample evidence that such exposure can lead to long term developmental damage,” his statement said. It noted that the bill “makes adequate provisions for children seeking single-use restrooms when needed and ensures that children are not forced to experience forced physical exposure to the opposite sex against their will.”

One of the most outspoken conservatives in the General Assembly, Marshall often rankles GOP leadership with bills to regulate social issues — which just as often die in committee. Among Marshall’s other bills this year is one that would declare pornography a public health hazard.

The bill comes as the U.S. Supreme Court has agreed to hear a case filed by transgender student Gavin Grimm, now a senior at Gloucester High in Gloucester, Va., who sued the school board in 2015 after it passed a policy barring him from using the boy’s bathroom. In April, a federal appeals court ruled in Grimm’s favor, citing the Obama administration’s position that such bathroom restrictions are a violation of Title IX, which bars sex discrimination in public schools. But the incoming Trump administration may stake out a different position, in which case the Supreme Court could remand the case to a lower court.

Legislatures around the country have clashed over transgender issues in recent years. North Carolina’s so called “bathroom bill” immediately ignited a firestorm, causing businesses like PayPal and Deutsche Bank to abandon expansions and prompting the NCAA and NBA to relocate sporting events. The bill also spurred a series of lawsuits, including dueling suits filed by the state and the Justice Department.

It appeared the law may have been on its way out late last month, when North Carolina lawmakers met for a special session specifically so they could rescind the measure. However, after an acrimonious day that saw Republicans feud over whether to fully or partially repeal the bill, they left it in place, prompting scathing criticism from Gov. Roy Cooper (D) as well as from gay and transgender rights groups.

Political analysts were dubious that Virginia will replay North Carolina’s script on the bathroom bill.

“I would bet my bottom dollar that we will never see such a bill emerge from the legislature,” said Larry J. Sabato, director of the Center for Politics at the University of Virginia. “The Senate would kill it, even if the House passes it. I doubt it even gets out of the House.”

Sabato said that the bill would face an almost automatic veto from McAuliffe. Democrats, he said, would be eager to use such a veto to highlight to Virginians what one-party Republican rule could mean for the state.

University leaders appeared to be leery of wading into the debate. Most are probably anxious to avoid generating friction with lawmakers as Richmond weighs other issues that affect their schools, including public financing of higher education.

Peter Blake, director of the State Council of Higher Education for Virginia, declined through a spokesman to comment, saying he had not yet reviewed Marshall’s proposal.

“We tend to follow pretty faithfully a rule of not commenting on proposed legislation, particularly at the start of the General Assembly, when there are so many bills out there and it’s impossible to say what might move forward,” said Justin Pope, chief of staff at Longwood University, a public institution in Farmville.

Representatives of the state flagship University of Virginia, the College of William and Mary and other prominent public universities did not immediately respond to messages seeking comment.

James Parrish, executive director of Equality Virginia, said the bill “would cause immediate harm to our transgender community and economy.”

State Sen. Adam P. Ebbin (D-Alexandria), a vocal proponent of gay and transgender rights, said Marshall’s bill would be highly problematic.

“I personally know one transgender man who, though born a woman, now has a full beard, shaved head, deep voice and a bulky build,” he said. “It would create much more controversy to require him to go into the ladies’ room without Bob Marshall telling him where he has to go to the bathroom.”

Robert Rigby, a Latin teacher at West Potomac High School in Fairfax County and an advocate for LGBTQ students, said he is “horrified” by the proposed requirement that school principals notify parents when transgender students ask to use different bathrooms or be referred to by different names or pronouns.

“Parents and children need to deal with this at their own pace without the schools taking charge,” Rigby said. Some transgender students tell their teachers and classmates before broaching the subject with their parents, and school becomes a safe haven. But if teachers are required under certain circumstances to inform principals of a student’s transgender status, “this will set up an atmosphere of distrust in the only place they have left to feel safe,” Rigby said.

Under Marshall’s bill, any government entity that owns or rents a building would have to ensure that restrooms and changing facilities “provide physical privacy from members of the opposite sex.” The bill states that “sex” “means the physical condition of being male or female as shown on an individual’s original birth certificate.”

Staff writers Mark Berman and Nick Anderson contributed to this report.

An earlier version of this story incorrectly stated that the bill would require school principals to notify all parents if a student at their children’s school asks ot be treated as a member of the opposite sex. The bill requires only that student’s parents to be notified. This story has been updated.