Heather Heidelbaugh wants to deny Pennsylvania Attorney General Josh Shapiro a second term. It’s an expensive and challenging proposition.

But the little-known Pittsburgh lawyer is getting some valuable help from allies of Sen. Pat Toomey — whom political watchers in both parties see as on a likely collision course with Shapiro in the 2022 governor’s race.

While the presidential election consumes voters’ attention, political insiders see the under-the-radar contest for attorney general as a potent prelude to a race that will be very much the center of attention in two years. That subplot played out Monday when a new group started airing digital ads critical of spending by the Attorney General’s Office under Shapiro. Toomey is indirectly helping the group.

Toomey has committed to raising significant amounts of money for the Republican Attorneys General Association, in anticipation that it will spend big to support Heidelbaugh, according to two Republican campaign consultants familiar with Toomey’s thinking. They spoke on condition of anonymity because they were not authorized to discuss Toomey’s plans.

“This is well-known in Republican political circles,” one of the consultants said of Toomey’s efforts. “He believes [Shapiro] will be the Democratic gubernatorial candidate. They want to dust him up before the election and deplete his resources.”

Win PA PAC, the group behind the new ads, was registered Aug. 18 in Harrisburg and lists the chief financial officer of the Republican Attorneys General Association as its treasurer in state filings, along with the association’s address and phone number in Washington.

The GOP attorney generals’ group has already invested $75,000 in Heidelbaugh’s campaign through another fund, Keystone PAC, which it registered in Harrisburg in March, again using the association’s Washington address. Keystone PAC gave Heidelbaughs campaign $50,000 in March and $10,000 in April. It spent an additional $15,000 for work by a Virginia-based research firm to support Heidelbaugh.

Citizens for Prosperity in America Today, Toomey’s political action committee, also gave Heidelbaugh’s campaign $10,000 in December.

There is nothing improper about a politician raising money for a group that is likely to further his or her political interests, or in money being moved between political groups.

Toomey’s campaign called Heidelbaugh “a long trusted confidant and friend” of the Republican senator but did not answer questions about his fund-raising plans. A spokesperson for the Republican Attorneys General Association did not respond to requests for comment.

Heidelbaugh, a 61-year-old Pittsburgh trial lawyer, is seen as a stronger candidate than the one Republicans fielded against Shapiro in 2016. She is a longtime local GOP activist and former member of the Allegheny County Council. She has also been a Toomey supporter for years and was one of his earliest backers in his first Senate run, an unsuccessful 2004 primary challenge to the late Sen. Arlen Specter.

“I’m running for Attorney General to fight for justice for all Pennsylvanians,” Heidelbaugh said in a statement. “After 35 years of courtroom experience, I have the experience to win the tough battles.”

While Heidelbaugh is widely considered an underdog, Shapiro isn’t invincible. His margin of victory in 2016, less than three percentage points, was the slimmest among Democrats who swept the statewide row offices, which include treasurer and auditor general. That came despite Shapiro’s besting the Republican nominee that year in fund-raising by more than 3-1.

Toomey, a Lehigh County Republican, and Shapiro, a Montgomery County Democrat, have spent the better part of 15 years working their way to the top of their parties in Pennsylvania.

Shapiro, 47, is now seen as a leading contender for governor — assuming he wins reelection. It’s less clear if Toomey, 58, will ultimately run. He would be facing reelection for a third term in the Senate, which could be less appealing if Republicans lose the White House and even possibly the Senate this year.

“It’s no shock that Pat Toomey is using back channels and his corporate money connections to help out his friend Heather Heidelbaugh, the insurance companies’ candidate,” Shapiro campaign spokesperson Dana Fritz said.

Any damage Heidelbaugh does to Shapiro’s political standing, win or lose, could benefit Toomey if the two face off two years later. Both Heidelbaugh’s campaign and outside groups backing her have made hay of Shapiro’s ambitions for higher office in their TV ads. One group called him “a career politician already looking to run for governor,” while Heidelbaugh pledged in her first ad to “serve my full term.”

“If you want to damage Shapiro and his long-term ambitions, a loss in his reelection bid for attorney general would certainly fit the bill,” said Chris Borick, a pollster and political science professor at Muhlenberg College in Allentown.

Shapiro’s campaign had more than $4 million in the bank as of June 22, while Heidelbaugh had about $209,000, according to state campaign finance records.

Another PAC with ties to a wealthy Toomey supporter is spending even more to support Heidelbaugh. Commonwealth Leaders Fund has reserved $435,000 worth of TV airtime in the race, according to the ad-tracking firm Advertising Analytics, and had spent $217,000 of that through last week.

Commonwealth Leaders Fund is flush thanks to support from Jeff Yass, the Main Line cofounder of Susquehanna International Group, an equities trading firm. Yass, who did not respond to requests for comment, contributed $100,000 in 2016 to Pennsylvanians for Prosperity, a political action committee working to help Toomey win a second term that year.

Yass has also given $6.6 million since February 2019 to Students First PAC, a group advocating for school choice issues that Yass has long supported. Yass is the PAC’s biggest contributor in the last two years, according to state campaign finance records.

Students First PAC gave $6 million in the same time frame to Commonwealth Children’s Choice Fund, a PAC established last year to also advocate on education issues. That makes Students First the largest contributor to Commonwealth Children’s Choice Fund, according to state records.

And Commonwealth Children’s Choice Fund gave $4.15 million from September to June to Commonwealth Leaders Fund. That makes Commonwealth Children’s Choice Fund the largest contributor to Commonwealth Leaders Fund.

Matt Brouillette, a conservative activist in Harrisburg, is treasurer for both Commonwealth Leaders Fund and Commonwealth Children’s Choice Fund. In an interview, he said he had a signed agreement with Students First that said he could spend the PAC’s contributions as he sees fit.

The Inquirer reported in October that Yass donated $1.25 million to Students First PAC a few weeks before that group donated $1 million to Commonwealth Children’s Choice Fund, which then sent $400,000 to Commonwealth Leaders Fund for use in statewide judicial races.

School choice is not typically an issue at the top of the agenda in races for state attorney general. Brouillette said his group’s ads in the race are motivated by a sense that Shapiro would “toe the line” for teachers’ unions if he is elected governor in 2022.

“Certainly we know Josh Shapiro has aspirations to run for governor and the impact that would have on educational opportunities,” Brouillette said. “As we look down the corridors of time and see who is the biggest opposition to kids getting the best education possible, we see Josh as a threat to that.”

Brouillette later emailed The Inquirer to say Students First contributions “are dedicated to school choice candidates for House and Senate.”