State attorneys general may be the freest actors in the American political system. Their broad discretion gives them enormous power, but it can also open them up to political and legal attacks.

Recently, a pair of Republicans found themselves caught in the currents of the presidential campaign. Pam Bondi, the attorney general of Florida, and Greg Abbott, who was attorney general of Texas prior to his election as governor, each canceled fraud investigations into Trump University and some time later their campaign accounts received five-figure checks, from Donald Trump in one case and from his foundation in the other. Both AGs maintained that any allegations of cronyism were without merit.

That may well be so, but it’s clear that attorneys general today have close and sometimes questionably comfy relations with entities looking to profit from their work. Last year, The New York Times won a Pulitzer Prize for its report on companies willing to wine and dine AGs and contribute heavily to their campaign accounts, in hopes of avoiding investigations and settlements. “It’s a situation that invites abuse,” says John Crangle of the liberal advocacy group Common Cause in South Carolina.

Attorneys general, most of whom are elected independently, are often described as the chief law enforcement officers in their states. That’s really a misnomer. Criminal cases are nearly always handled by district attorneys at the county level. AGs can get involved in criminal matters, but most of their focus is on consumer protection and other civil issues.

Indeed, they have become de facto national regulators of various industries, demanding that banks or other businesses change their ways as part of legal settlements. Given their status as free agents, they can turn those pressures off as easily as they can turn them on. “AGs have found a way to transform the office, so it’s not just rote law enforcement but really important in terms of making policy,” says Paul Nolette, author of a recent book about state AGs.

Which cases they choose to pursue is pretty much up to them. That has allowed Republicans to challenge the Obama administration on fronts ranging from health care to environmental regulation. Conversely, Democratic attorneys general opted not to defend state laws banning same-sex marriage.

This year, Attorney General Roy Cooper, who is the Democratic candidate for governor in North Carolina, chose not to defend the state’s controversial law blocking municipalities from enacting anti-discrimination laws to protect LGBT residents. “In a lot of these states, if the governor and the attorney general take opposing positions, the attorney general gets to decide on litigation questions,” says Timothy Meyer, a law professor at Vanderbilt University. As Meyer notes in a law review article, AGs enjoy a near-monopoly on the state’s access to the courtroom, meaning the use of litigation as a tool to advance policy is “almost exclusively” in their hands.

All of this helps to explain why political opponents -- recognizing the power an attorney general wields -- have sought to link them to official misconduct. The aura of their office means that allegations that might be shrugged off as normal conduct for lawmakers can stick like glue when it comes to those tasked with enforcing the law.

Besides Abbott and Bondi, attorneys general in several states have found themselves accused of legal or ethical missteps in the past couple of years. Last month, Pennsylvania’s Kathleen Kane was found guilty of perjury and subsequently resigned. Ken Paxton, who succeeded Abbott as the Texas AG, finds himself facing charges from both local prosecutors and the Securities and Exchange Commission regarding allegations flagged by liberal groups that he misled business investors before taking office. “In a different era, when the AG was not seen as a highly partisan person or high profile in the state, activists wouldn’t have pushed so hard on the case,” says Mark Jones, a political scientist at Rice University.

*An earlier version of this story stated that former Texas Attorney General Greg Abbott canceled a fraud investigation into Trump University and "in short order" received a five-figure check to his campaign account. Donald Trump's donation to Abbott came three and a half years after the investigation was concluded and Trump U left Texas.