Republican gubernatorial candidate Ed Gillespie. (Steve Helber/AP)

Republican Ed Gillespie won the endorsement of an influential Northern Virginia business group after privately pledging he would oppose any bills dictating which bathrooms transgender people must use — a promise that shocked conservative backers and seems to differ from some of his public statements.

The gubernatorial candidate “vowed to oppose bills like North Carolina’s HB2 that would threaten Virginia’s reputation as an open and welcoming Commonwealth,” Jim Corcoran, president of the Northern Virginia Chamber, said in a written statement announcing the endorsement by the organization’s political action arm, Novabizpac.

Corcoran was referring to North Carolina’s now-repealed law mandating that transgender people use the bathroom corresponding with the sex on their birth certificates. The law faced an intense backlash, including economic boycotts and job losses, with sports leagues relocating games and companies nixing expansions in North Carolina.

In an interview Friday, Corcoran said Gillespie promised to oppose similar legislation two weeks ago during a private interview with the 25-member board. He said the position factored into the board’s decision to back Gillespie over his Democratic rival, Lt. Gov. Ralph Northam, who has long supported LGBT rights. Corcoran said Gillespie made the vow after the board expressed concerns about HB2.

“We stated that we are an open and welcoming state here, we don’t want anything that is going to persuade persons that this is not a conducive place to do business,” Corcoran said.

Gillespie spokesman David Abrams did not dispute that account and said the candidate’s opposition should come as no surprise. “Ed has always been clear he opposes legislation like HB2 in North Carolina, and he is honored to earn this critically important endorsement from the NOVA chamber,” Abrams said.

But when the General Assembly considered a bathroom bill in January, Gillespie did not state a clear position. Rather, his campaign issued a statement that seemed aimed at having it both ways — echoing concerns raised by the bill’s advocates and taking a swipe at an Obama administration restroom directive, while also suggesting that the matter should be left up to localities.

“Ed doesn’t think girls should be compelled to share a locker room shower or hotel room on an overnight band trip with boys,” then-spokesman Matthew Moran said via email. “As governor, he would work with the Trump Administration to end the Obama Administration’s overreaching policy so parents and local school boards can enact commonsense policies to protect the safety and privacy of our children. They should make these decisions, not the state or Federal Government.”

Gillespie used stronger language — with no nod to local control that could be construed as opposition to state bathroom bills — at a Republican gathering in Amherst, Va., in April.

“You know it’s interesting, the left is so adept at using language. And so they talk about bathroom bills. This isn’t about bathrooms alone,” he said, repeating warnings about co-ed showers and hotel stays. “And the fact is, we have to make clear that we are going to protect our children from that. We are not going to allow for that to happen.”

The latest stories and details on the 2017 Virginia general election and race for governor.

Don Blake, president of the Virginia Christian Alliance, said he was surprised and upset to learn that Gillespie promised the business group he would oppose bathroom bills.

“It’s a very dangerous thing to speak out on positions that offend your base,” said Blake, who said he worked hard on Gillespie’s unsuccessful U.S. Senate bid in 2014.

“I’ve spent . . . a lot of time with him, talking about his Catholic faith, and he believes in the same things I believe in. He’s pro-life and pro-marriage,” Blake said. “To make a statement like that to get an endorsement from a business group will disappoint a lot of people. . . . It weakens your support. It doesn’t mean the base won’t go vote for him, but they may not put up yard signs and make phone calls.”

Northam spokeswoman Ofirah Yheskel said the lieutenant governor is the “only person in the race that will keep Virginia inclusive and welcoming to new businesses.”

“It’s hard for voters to know what to believe from Ed Gillespie when, at every turn, he is caught talking out of both sides of his mouth on the issues that matter,” she said.

Four years ago, the chamber’s political arm endorsed all three Democrats running for statewide office, a first. The slate included Northam, then running for lieutenant governor. Corcoran said the PAC based its latest endorsement on the candidates’ voting records (if applicable), their performance in the chamber’s televised debate about a week ago and their interviews. There were no written surveys.

Northam, a moderate as a state senator, campaigned last year against an unsuccessful effort to enshrine the state’s right-to-work laws in the Virginia Constitution. He moved left on some business issues during a hard-fought primary, coming out for a $15-an-hour minimum wage. He is running with enormous support from labor unions.

Corcoran said the PAC agrees with Northam’s call to expand Medicaid under the Affordable Care Act, which Gillespie opposes.

“This was a very hard decision because we have two really strong candidates,” Corcoran said. “It’s not black and white. There’s a lot of gray here.”

The PAC also endorsed state Sen. Jill Holtzman Vogel (R-Fauquier) over former federal prosecutor Justin Fairfax (D) in the race for lieutenant governor. And it backed Attorney General Mark R. Herring (D), who is running for reelection, over Republican challenger John Adams, a prominent Richmond lawyer and former federal prosecutor.

Concern over legislating transgender bathroom use was one of three issues Novabizpac highlighted in its announcement, along with transportation and right-to-work laws.

Herring has championed LGBT rights as attorney general, refusing to defend the state’s ban on same-sex marriage. Vogel broke with most of her party to vote this year to ban discrimination against gay and transgender people in housing and public employment. She took heat from her Republican primary opponent for supporting the appointment of an openly gay judge.

But ahead of her primary, Vogel raised all-caps alarms with a mailing about the Obama administration’s order to allow transgender students to use the bathrooms of their choice: “DO YOU WANT BARACK OBAMA TO SET TRANSGENDER BATHROOM POLICIES AT YOUR CHILDREN’S SCHOOL?”

Vogel has said she was objecting to a heavy-handed federal mandate, not the goal of protecting transgender students. Her campaign handed out rainbow stickers at Richmond’s LGBT Pride festival last weekend, and she was scheduled to appear at another such festival in Northern Virginia this weekend.

In her interview, Vogel assured the PAC that “she would never support anything that’s discriminatory,” Corcoran said.

In the PAC’s announcement, he noted Gillespie’s position on key transportation issues, saying the candidate “committed to oppose any effort to roll back the landmark HB2313 transportation funding legislation and to support the long-term financial and operational viability of Metro.”

HB2313 is the sweeping transportation deal passed in 2013 that overhauled the way Virginians pays for roads, highways and mass transit.

Gillespie’s stance on the bill — which Herring supported as a senator but Vogel voted against — is complicated. Gillespie attacked Northam for voting for the bill as a senator, saying he supported “the largest tax increase in Virginia history.” The claim was true but awkward, since the $1.4 billion-a-year deal was backed by GOP leaders and was considered the chief legislative achievement of Gov. Robert F. McDonnell, a Republican. Gilles­pie was chairman of McDonnell’s 2009 campaign.

When Gillespie caught flak for blasting the bill in July, his spokesman told the Richmond Times-Dispatch: “Ed was proud to support Bob McDonnell’s campaign for governor in 2009. In 2017, he is running on his own policies versus Ralph Northam’s.”

That was hardly a ringing endorsement of the transportation funding the PAC considers so important, but he has never suggested repealing the law — an idea that has no traction in Richmond.