It was a move Republicans knew well: In the final years of the Obama administration, the GOP used attorneys general offices in states like Oklahoma, Texas and Nevada to ignite legal challenges to key elements of the Democratic president’s agenda, like the Affordable Care Act and the Clean Power Plan.

“We’re in this very unique moment in history when the courts and the lawyers matter more than ever,” said January Contreras, a Democrat running against Arizona Attorney General Mark Brnovich (R). “The laws and the courts are where we’re going to stop the worst from happening.”

Today, once-sleepy contests to become a state’s chief legal officer are getting new attention from major party donors, who see those offices as both a bulwark against an overreaching federal government and as a bench-building exercise that will highlight and promote the next generation of national leaders.

“What we have seen over the last 15 or so years is really the weaponization of the state AG offices into something that plays at a much more robust level at the federal level. They have figured out a way to legislate through litigation, both in state courts and federal courts,” said George Brauchler (R), a district attorney running to become Colorado’s next attorney general.

“You turn these attorneys general positions into almost like third U.S. Senators. They can bring an administration to its knees,” he added.

Party officials and strategists overseeing the 30 attorneys general seats up for election this year say those races are attracting an incredible amount of donor interest and spending. Some estimate the two sides will spend more than $100 million on the contests, two or three times more than has ever been spent on attorneys general races before.

For generations, Democrats held far more attorneys general seats than did Republicans. As recently as 1993, Democrats held 34 attorneys general offices, while Republicans held just nine. Republicans only gained a majority after the 2010 landslide, and today they own a 24-seat to 19-seat advantage.

But that edge is likely to narrow some after this year’s midterms, as Republicans find themselves on defense in key states. Republican incumbents are retiring or running for other office in states like Colorado, Nevada, Florida, Ohio and Michigan, all of which Democrats see as promising pickup opportunities.

Democrats are fielding potentially strong challengers to Republican incumbents in states like Arizona, Arkansas, Georgia and South Carolina.

Republicans, meanwhile, believe they can make a run in Minnesota, where the sitting Democratic attorney general is stepping down.

Both Democrats and Republicans tend to favor law-and-order prosecutors as nominees for attorney general, even though an AG rarely sees the inside of a courtroom. Republicans have nominated prosecutors to run in open seats in Colorado, Nevada, Ohio, Michigan and Maryland.

“I think it’s important that you’ve actually prosecuted a criminal case,” said Wes Duncan, the Republican nominee in Nevada. “Experience really matters in the job.”

This year, Democrats are relying heavily on alumni of the Obama administration.

Contreras, in Arizona, worked in Obama’s Department of Homeland Security. Peter Neronha, the Democratic nominee in Rhode Island, was a U.S. Attorney under Obama. Phil Weiser, Brauchler’s Democratic opponent in Colorado, served as deputy assistant attorney general in Obama’s Justice Department.

“Their goals are couched in terms of the rule of law, but what it’s really about is defending Obama’s legacy and stopping the Trump administration,” Brauchler said.

Nominees in both parties acknowledge that the heated national debate has encroached on offices that were once more concerned with implementing and enforcing local laws.

“We certainly saw the Obama administration trying to accomplish through executive action what he couldn’t accomplish through the constitutional system,” Duncan said. “It was attorneys general at every single term who tried to preserve the constitutional system.”

In some states, Democrats plan to run campaigns against Republican incumbents who have joined a lawsuit filed by Texas Attorney General Ken Paxton (R) that challenges the Affordable Care Act’s protections for those with preexisting conditions.

“Each attorney general has to evaluate what’s right for their state. I don’t envision myself twirling around in my chair thinking about how do I sue the Trump administration today?” Contreras said.

She also took aim at some of her opponents' priorities.

“We’re currently suing to eliminate the Affordable Care Act. We’re defending the secrecy of Koch brothers donors. That’s not the job of the attorney general,” she added.

Those who win office this year will face a host of challenges, from a mounting opioid epidemic to ongoing lawsuits over health care, environmental and labor regulations.

They will also find themselves under pressure from state and national party leaders to consider their own futures — the running joke is that AG stands for “almost governor.”

Seven sitting governors ascended to their current posts after serving as their state’s attorney general.

And those ranks could swell: Republican attorneys general are running for governorships in Nevada, Ohio and Michigan, and for Senate in Missouri and West Virginia.

There are signs that even some members of Congress see their careers advancing through attorney generalships back home, rather than in Washington.

“Our friends on the other side recognized the value of AGs early and started investing in Republican AG races in order to grow their bench,” said Sean Rankin, who heads the Democratic Attorneys General Association.

This year also marks the first major election after the breakdown of a long-standing, if mostly unspoken, agreement that neither party would challenge the other’s incumbents.

Republicans spent heavily on an unsuccessful challenge to Virginia Attorney General Mark Herring (D), a race Democrats say opened the floodgates.

“You’ve got to give them credit for getting out and investing in AG races early,” Rankin said.

Democratic donors, he added, “have started to realize what the other side already knew, which is that this office has incredible power to push back on an administration that doesn’t understand the rule of law.”