President Trump has emerged as a culture warrior for nationalism, advocating a more restrictive immigration system, imploring NFL players to stand for the anthem, and pushing to preserve Confederate heritage in the South.

But it's unclear the extent to which Trump's identity politics — long associated with the left, and criticized by Republicans — have changed social conservatism. Two statewide races this year in Pennsylvania, a state Trump carried in 2016, could help answer that question.

In the race for the GOP nomination for governor, social issues that galvanize the religious right, such as abortion and transgender rights, are driving much of the early debate among the four candidates. Members of the state party committee will meet in a few weeks to decide whether to endorse in the May 15 primary.

In the U.S. Senate race, however, the front-runner for the Republican nomination built his political career on vehement opposition to illegal immigration, well before Trump made it one of the defining cultural issues in America.

"There's some belief, especially with President Trump's success, that leveraging emotional issues, with immigration, or sometimes even race, can be part of a successful strategy," said Christopher Borick, a political scientist and pollster at Muhlenberg College in Allentown.

"A lot of people are wondering right now if his recipe, if you will, is one that is transferable or even one that might be successful for others," Borick added. "Pennsylvania is going to be a test to that in some ways."

To be sure, Trump is relatively popular among evangelicals and has taken up some of their causes, such as unsuccessfully attempting to ban transgender people from the military. But even as he stokes more recent cultural controversies, some social issues that have long been important to Republican primary voters endure.

That helps explain why most of the GOP gubernatorial candidates lambasted Gov. Wolf, a Democrat up for reelection in November, last month for vetoing legislation that would have banned abortion at the 20-week mark of pregnancy, with some exceptions. The bill also would have banned a common second-trimester medical procedure opponents call "dismemberment abortion."

House Speaker Mike Turzai (R., Allegheny) shepherded the legislation through his chamber, and Sen. Scott Wagner (R., York) also voted for it. Both are running for governor. Two other GOP candidates, lawyer Laura Ellsworth and business executive Paul Mango, say they support the measure.

Mango, who lives outside Pittsburgh, released a provocative video that shows an ultrasound of a fetus 23 weeks into pregnancy. That late, the narrator says, a baby "can already taste and even feel pain."

Even so, "That's when Gov. Tom Wolf said he will make sure performing an abortion on an unwanted child is perfectly legal. And that's unconscionable."

By contrast, the narrator describes Mango as "pro-family, pro-faith, and ready to fight every day for the unborn."

The digital-only video attracted about 60,000 views, said John Brabender, a Mango adviser. "Pro-life engagement in Pennsylvania is huge," he said.

Brabender, a former adviser to presidential candidate Rick Santorum, added: "What Republicans are looking for is, Who's going to stand up and not be afraid to call out Wolf on some of these issues that are important to the party?"

But if Republicans wanted to energize their base, they also handed Wolf an easy political win by showing supporters of abortion rights the importance of his veto pen.

"He is the one thing standing in the way of some of these extreme legislators who are trying to chip away at access" to reproductive-health care, said Lindsey Mauldin, deputy director of Planned Parenthood Pennsylvania Advocates.

A spokeswoman for Wolf said the governor was "determined to protect women's health" and would block GOP efforts to "undermine women and move Pennsylvania backward."

In Pennsylvania, 51 percent of  adults say abortion should be legal in all or most cases, while 44 percent say it should be illegal in all or most cases, according to a 2014 Pew Research Center poll. And 5 percent said they didn't know.

While the Keystone State electorate has become more progressive on such issues as gay marriage, it has remained "fairly divided" over abortion, Borick said.

The Republican candidates' positions on protections for lesbian, gay, bisexual, and transgender people are also likely to come under scrutiny from primary voters.

For his part, Wagner has sponsored legislation that would prohibit discrimination based on sexual orientation, gender identity, or expression in housing, employment, and public accommodations. It hasn't come up for a full vote in either house of the legislature.

"I'm a big believer in fairness," he said in an interview. Wagner, owner of waste-management and trucking businesses, added, "I didn't get where I am today, and I didn't build these companies, by [being] unreasonable and extreme."

Some conservative groups have described the legislation as a "bathroom bill." The American Principles Project, a Washington-based nonprofit that advocates "human dignity in public policy," launched a website accusing Wagner of "forcing girls to share their locker rooms and showers with boys."

"It's bad enough that Gov. Wolf has tried to push gender ideology on Pennsylvanians for the past three years," the website says. "Why would we want 'Conservative' Scott Wagner to continue it?"

Wagner's spokesman said that mischaracterizes the legislation and that the senator would oppose such a provision.

Wagner, who fashions himself as a blunt-speaking truth-teller, has said Trump "is similar in many ways to me," and was endorsed by Steve Bannon, the former Trump strategist who the president said Wednesday had "lost his mind." But it's Republican Rep. Lou Barletta who is running on a Trumpian platform in his bid to unseat U.S. Sen. Bob Casey (D., Pa.).

As mayor of Hazleton, Luzerne County, Barletta drew national attention when he signed a 2006 ordinance that would have fined landlords and revoked licenses from businesses that harbored or hired undocumented immigrants. Federal courts found the ordinance unconstitutional and it never took effect. Other Republicans seeking their party's nomination include retired energy executive Paul Addis, of Haverford, and state Rep. Jim Christiana, of Beaver County.

As a congressman, Barletta praised Trump's rescinding of an Obama-era executive order that provided protections to so-called Dreamers, people who were illegally brought by their parents to the U.S. as children.

Casey, by contrast, supports sanctuary cities and wants to protect Dreamers. "Pennsylvanians want Congress to come together and actually get something done to reform our immigration system," said Max Steele, a spokesman for the state Democratic Party. "Congressman Barletta's partisan grandstanding does nothing but make Washington gridlock and our immigration problem worse."

Republicans have also questioned the sincerity of Casey's pro-life position, given his support of Planned Parenthood. And his broader lurch to the left — he called on Trump to resign, for example — could alienate centrists, his opponents argue.

Seventy-one percent of registered Republicans in Pennsylvania approve of Trump's handling of immigration, compared with 5 percent of Democrats, according to a September Franklin and  Marshall poll.

The president's job performance ratings among registered voters fell from 37 percent in May to 29 percent in September, according to the survey.

"You can have a compassionate viewpoint on immigration, but at the same time stand up and represent people who have followed the rules, people whose jobs are on the line," said Brabender, the GOP consultant, who is also advising Barletta.

The Pennsylvania Senate race, he said, "may end up being elevated to the most-watched race in the country because it's going to be the strongest contrast on these issues."