Ted Wells, one of the nation's most prominent litigators for big corporations, was about to win again as he sat with his team in a Dallas courtroom last fall, representing ExxonMobil. U.S. District Judge Ed Kinkeade looked their way and joked, "Y'all have 300 lawyers on your side."

Wells, 66, had come before Kinkeade to thwart fraud investigations launched by the attorneys general of New York and Massachusetts, who are looking into whether the mammoth oil company has misled investors and the public for years about the dangers of climate change.

Kinkeade, with his folksy joshing and pointed comments, made little secret of his sympathies. He kidded that his horse was tied up outside and he might need an interpreter to pierce the Boston accent of the Massachusetts counsel. He wondered aloud if those Northern officials would be as worried about the climate if their states had as much oil as his native Texas. "I'm just saying, think about it."

A little more than three weeks later, he handed Exxon a major victory, ruling that Massachusetts Attorney General Maura Healey may have acted in "bad faith." Some legal scholars said the order could give Wells unprecedented license to try to prove that Healey was part of a conspiracy to silence Exxon in the debate over climate policy.

The investigators had suddenly become the investigated, a striking example of a legal strategy of massive resistance to any effort to hold Exxon accountable for global warming or harm to the environment. The message from Exxon, delivered by Wells and his army of lawyers: Mess with us at your peril.

Exxon is not alone. Its defiant stance is typical of the fossil fuel industry's fight against stronger government oversight and efforts to protect public health. Fossil fuel corporations doggedly battle lawsuits, regulations and investigations, because it allows them to continue pumping oil, mining coal and fracturing for natural gas—and banking the profits—even if sometime later there will be a reckoning, said Christine Todd Whitman, former administrator of the Environmental Protection Agency under President George W. Bush.

"It's a decision they make based on hard numbers," she said in an interview.

Wells pursued a similar course years ago, when he represented Philip Morris against government charges that it hid the health dangers of smoking. The tobacco industry eventually lost and paid dearly, but its long war of attrition bought time.

The Exxon case took an unexpected detour in late March, when Kinkeade, perhaps recognizing that he was on thin ice because the alleged conspiracy hadn't taken place within his jurisdiction, transferred the case to federal court in New York. The company starts over with a new judge, Valerie Caproni, who signaled she is less sympathetic to its arguments than Kinkeade was.

Still, there will be more filings and motions and more costly delay for Healey and a coalition of state attorneys general who announced more than a year ago their intention to take on the fossil fuel industry over its role in climate change.

Wells and Exxon declined to comment for this article.

A review of their fight against the attorneys general shows how tenacious—some opponents say ruthless—Exxon can be:

The tiny Virgin Islands dove into an investigation alongside Healey and New York Attorney General Eric Schneiderman and was quickly driven to surrender when the company and an allied conservative think tank filed lawsuits against its attorney general. They charged abridgement of their constitutional rights. After that, no other attorney general started new investigative action, and the attorney general of Maryland says their coalition now exists "in name only."

Exxon's subpoenas went far beyond the attorneys general and demanded information from non-profit environmental groups and even private individuals active in the national climate debate. Those targeted saw the subpoenas as an effort to intimidate them. A member of an Exxon advisory board resigned, saying that the company was not acting as a good corporate citizen by pressuring those organizations.

The revelation that former Exxon chief executive Rex Tillerson used a separate email account, with the alias "Wayne Tracker," to discuss the implications of climate change with his board of directors and key executives could put the company back on the defensive. But, even as Wells acknowledged that some of the Wayne Tracker e-mails may not have been preserved, he counter-attacked in familiar fashion. He declared that New York's demand for those emails was part of "a highly politicized and bad faith investigation."

This article is the first of a series examining the formidable power the fossil fuel industry deploys across society to protect its interests. It fights adversaries as small as a family in Louisiana suing over a natural gas pipeline that polluted their property and as large as the federal government, with its rules aimed at reducing carbon emissions nationwide. The industry sowed doubt for decades about climate science, spending $2.9 billion on advocacy advertising alone in a 10-year period ending in 2015. It spent $1.3 billion more lobbying to shape public policy on energy issues during the same period and has pumped out $827.9 million in campaign contributions since 2000 to elect sympathetic officials at the local, state and federal levels.

In an ironic twist, industry backers, who typically declare devotion to free markets, have sought to weaken or even ban competition from other sources of energy. A bill authored by coal supporters in Wyoming would have forbidden electricity from wind power in the state. Solar power is a frequent target of efforts to add surcharges to make it less affordable.

The industry is exercising its influence at a particularly delicate moment. Climate change is accelerating and global momentum has grown to deal with the crisis, culminating in last year's landmark Paris Agreement. But the U.S. elected a new president, Donald Trump, who has signaled solidarity with the industry and yanked the United States out of the Paris accord. The president has branded climate change a hoax and installed officials at the Environmental Protection Agency and other key departments dedicated to expanding fossil fuel production and undoing Obama-era efforts to curb greenhouse gas emissions.

And the man at the center of the investigation by the attorneys general, Exxon's Tillerson, is now Secretary of State, a post giving him authority over climate diplomacy.

From Fanfare to Rounds of Legal Warfare

With great fanfare, New York's Schneiderman announced the formation of AGs United for Clean Power in March 2016. The coalition was formed after investigative articles first by InsideClimate News and later the Los Angeles Times disclosed that Exxon learned from its own scientists about the consequences of climate change as early as 1977, but chose to curtail its research and eventually worked to deny the findings.

The attorneys general, Schneiderman said at a news conference, were "dedicated to coming up with creative ways to enforce laws being flouted by the fossil fuel industry and their allies in their short-sighted efforts to put profits above the interests of the American people and the integrity of our financial markets."

Healey said, "Fossil fuel companies that deceived investors and consumers about the dangers of climate change should be, must be held accountable." Exxon would later charge that those comments indicated Healey had prejudged the outcome of her investigation.

At their side were five other attorneys general and staff representing 10 more, from California to Rhode Island. Former Vice President Al Gore added star power to the assembly.

Despite the showy news conference, the attorneys general were unprepared for what was to come, and they made tactical errors at the start that gave Exxon ammunition for its counter-attack. David Vladeck, a Georgetown University law professor and former director of the Bureau of Consumer Protection at the Federal Trade Commission, said the group had too little understanding of each member's commitment. And they allowed the tiny Virgin Islands a prominent role that turned out to be a mistake, he said.

The morning of their news conference, the attorneys general met privately with climate activists, handing Justin Anderson, one of Exxon's lawyers, an opening to argue to Kinkeade that the coalition, all Democrats, was abusing the law enforcement system to seek a political goal. Kinkeade later seized on that argument, asking why the attorneys general wouldn't want to assure the public that their actions "lacked political motivation and were in fact about the pursuit of justice."

Eric Soufer, a spokesman for Schneiderman, said engaging a variety of sources is part of the investigative process. "Like all prosecutors' offices, we speak with a diverse array of stakeholders on a range of matters, all the time," he said. "It's part of our job."

Peter Frumhoff, director of science and policy for the Union of Concerned Scientists, said he briefed the attorneys general at the meeting on Exxon's "deception and the impact of climate change that might have been averted if they had taken action."

At the press conference, Attorney General Claude Walker of the Virgin Islands stood defiantly at the lectern and announced the fight was on with Exxon.

"It could be David and Goliath, the Virgin Islands against a huge corporation, but we will not stop until we get to the bottom of this," Walker said. He soon issued sweeping subpoenas to Exxon and the Competitive Enterprise Institute, a libertarian think tank aligned with and heavily financed by the industry.

Exxon and CEI almost immediately started filing a series of motions to have the subpoenas dismissed. They didn't play defense for long. Within weeks they filed lawsuits of their own against Walker, alleging he was violating their First Amendment right to disagree with the prevailing scientific consensus that climate change is overwhelmingly driven by burning fossil fuels.

Faced with a legal battle that might go on for years and the concern that losing an early round could undermine the larger investigations by New York and Massachusetts, Walker withdrew his subpoena of CEI and suspended his investigation of Exxon.

Sam Kazman, the general counsel for CEI, said Trump's election and his installation of Scott Pruitt, a climate change denier, as head of the EPA show that Schneiderman and the other members of what Kazman called "AGs United for More Power," badly misinterpreted the national attitude on the issue. "It's hard for Schneiderman to conclude that we were deceived when that skepticism is shared by the EPA under the new administration," he said.

Neither Walker nor lawyers representing the Virgin Islands would discuss the case or its dismissal. Donna Christensen, a St. Croix resident who served 18 years as the islands' non-voting representative in the U.S. House of Representatives, said the territory relies on Congress for much of its budget.

"We are in a very fragile financial situation," she said. "We don't need to make any enemies."

In retrospect, said Michael Gerrard, who teaches climate law at Columbia Law School, the coalition had started a fight that was far greater than some were prepared to wage.

Exxon initially cooperated with New York, surrendering more than two million pages of records. But the company balked at a documents request from Healey and took its argument to Kinkeade, who allowed Exxon to question attorneys general and climate activists in its search for evidence of a conspiracy.

When Kinkeade, a Republican appointed by President George W. Bush, sent the case to New York, he laid out Exxon's allegations in detail, presumably a road map for his successor to follow. But Caproni, appointed by President Barack Obama, said at a hearing, "I have a different view of this case than Judge Kinkeade." When one of Exxon's lawyers sought a discovery order like the one Kinkeade granted to allow the company to try to prove that the attorneys general were improperly colluding, Caproni shut him down. "Gimme a break," she said.

Carroll Muffett, president and chief executive of the nonprofit Center for International Environmental Law, was one of those subpoenaed by Exxon.

"I knew from the very beginning that Exxon would eventually come after us hard and it would be a dirty fight," Muffett said. "They are fabricating conspiracy theories to deflect attention from the truth."

The Rockefeller Brothers Fund and the Rockefeller Family Fund, philanthropic organizations that promote environmental causes among their numerous programs, also were the targets of Exxon subpoenas. Both organizations are among donors that support ICN.

To defend itself, Exxon argued in the subpoena that it needed to know whether Muffett's and other non-governmental organizations influenced the attorneys general's decisions to open investigations.

That legal strategy prompted Sarah Labowitz, a New York University scholar who served nearly three years on Exxon's External Citizenship Advisory Panel, to resign.

Labowitz, who until recently was co-director of the Center for Business and Human Rights at the NYU Stern School of Business, said she had enough when the company went after Muffett and others unrelated to the two state investigations.

"I am disappointed that instead of examining its own record and seeking to restore a respected place for itself in the public debate, Exxon has chosen to turn up the temperature on civil society groups," Labowitz wrote in her resignation letter.

Watching the New York and Massachusetts investigations being sucked into a legal quagmire are the other attorneys general who were part of the coalition.

Maryland Attorney General Brian Frosh said, "I'm sure anybody who is considering moving ahead with an investigation or action would take into consideration the ferocity of what they've seen so far of Exxon's defense," he said. In addition to the federal case, the company has filed suits in state courts in New York and Massachusetts, seeking to quash the probes.

Exxon's Tactic of Delay

Exxon battles not only so it might profit while cases inch through the courts, but also to buy time until a more favorable political environment comes along.

For more than a decade, the company fought a lawsuit filed by the state of New Jersey to recover $8.9 billion, alleged damages from more than a century of pollution caused by Exxon refineries.

Brad Campbell was New Jersey's environmental commissioner when he authorized the lawsuit in 2004. He said in an interview that litigation became the last resort after Exxon refused to negotiate a settlement with the state as other companies, such as Chevron, had done.

Exxon lost a number of key battles that established its liability but nevertheless continued to fight, year after year, through the administrations of four governors.

"Exxon really stands in a class by itself in terms of a scorched earth approach to environmental claims of any sort," said Campbell, who is now president of the Conservation Law Foundation, a New England-based environmental organization that also has sued the company.

"They litigate more aggressively and often devote resources to fighting claims that aren't rational given the cost of resolving them in a constructive way."

But Exxon delayed long enough to get a favorable outcome. In 2015, at the direction of Gov. Chris Christie, who was campaigning for the Republican presidential nomination, New Jersey accepted a settlement of $250 million, or about 3 cents on the dollar.

Similarly, Exxon has been resisting for years a proposed federal pipeline safety fine of $2.7 million for a spill that dumped 210,000 gallons of heavy Canadian crude oil into the streets of Mayflower, Arkansas, in March of 2013. The fine for the spill, which sickened residents, forced evacuations and rendered some homes uninhabitable, would represent a tiny fraction of the company's 2013 revenues of more than $420 billion.

An Ally in the White House, but Much Explaining to Do

Exxon has enjoyed the consistent support of many Republican attorneys general and Republicans in Congress. That includes Rep. Lamar Smith, chairman of the House Science Committee and a climate change denier, whose largest campaign contributions last year came from the oil and gas industry.

The Texas Republican subpoenaed the attorneys general investigating Exxon, threatened subpoenas for the other coalition members and subpoenaed non-governmental environmental organizations that had supported the coalition.

Smith said during a news conference that, "The attorneys general have appointed themselves to decide what is valid and invalid regarding climate change. Attorneys general are pursuing a political agenda at the expense of scientists' rights to free speech."

Smith remains in a standoff with the environmental organizations and two attorneys general, who are refusing to comply with the subpoenas.

Unlike Smith, Exxon's legal team doesn't deny climate science. In fact, Exxon now acknowledges the risk of burning fossil fuels and has expressed support for a carbon tax. Echoing an argument he made to defend Philip Morris more than a decade ago, Wells says the company should be judged by its current behavior, not what it might have done in the past.

As New York investigators were digging recently through the mountain of documents Exxon turned over at the start of the investigation, they uncovered Tillerson's Wayne Tracker alias.

Now Exxon has a lot of explaining to do, said Wendy Jacobs, a professor of environmental law and director of the Harvard Law School Emmett Environmental Law & Policy Clinic.

The emails are a "scandal" that put "Exxon and its credibility and forthrightness in a bad light," said Jacobs, who served in U.S. Department of Justice's Environment Division.

"What will really derail Exxon is if there is a smoking gun buried in the Wayne Tracker emails. That remains to be seen," she said.

Vladeck, the Georgetown University law professor, said he thinks that the attorneys general lost time and resources with their initial missteps. But, he added, "The investigators have recovered, and the investigations are getting back on track."