New York, N.Y.— Even as New York Attorney General Eric Schneiderman accused ExxonMobil in court on Wednesday of refusing to turn over emails as part of a broad investigation he opened a year ago, he found himself ensnared in an email scandal of his own.

In response to a request by Schneiderman, a state judge in New York on Wednesday directed ExxonMobil Corp to work with the attorney general’s office to attempt to recover lost emails from an account once used by Rex Tillerson, who stepped down as the company’s chief executive to serve as U.S. Secretary of State.

In recent weeks, the probe has received national publicity from the revelation that former Exxon CEO and current U.S. Secretary of State Rex Tillerson had used a second email address under the partial alias “Wayne Tracker” for some of his communications (“Wayne” is Tillerson’s middle name).

Schneiderman and his allies have seized on the account in order to cast the company as less than cooperative in providing documents the attorney general requested, even though the company had in fact turned over some emails to Schneiderman from the Wayne Tracker account.

But as the Wayne Tracker issue played out in a Manhattan courtroom Wednesday morning, Schneiderman himself got caught up in controversy over refusing to release his own internal communications with environmental activists discussing the Exxon probe.

Schneiderman’s own office was revealed on Wednesday to have used private email accounts to communicate with climate activists outside of the attorney general’s office’s email system, according to a report from the Daily Caller. If the meetings set using private email accounts had the purpose of gathering evidence for the Exxon investigation, it could be a violation of New York law, according to the conservative news outlet’s reporting.

As part of a Freedom of Information Act request, Schneiderman’s office revealed it had extensive correspondence with Lee Wasserman of the Rockefeller Family Fund, the key financial backer behind attacks on Exxon, in the months leading up to the announcement of the investigation. Schneiderman’s office has refused to release the contents of those emails.

During the hearing in New York, and in letters sent to the court in recent weeks, the attorney general’s representatives argued that Exxon has slow-walked their compliance with a judge’s far-reaching order to turn over documents detailing what executives knew when about climate change.

The energy giant’s lawyers have responded by asserting that the New York Attorney General’s lawyers care more about burnishing their boss’s political credentials with the press than they do about proving their case against Exxon in the courts.

ExxonMobil, an oil and gas company based in Texas, is one of the largest companies in the world. The multinational has been the subject of multiple state investigations over the past two years. Those investigations began over allegations that Exxon intentionally funded misleading climate science research, and which accusers later walked back to focus on narrower allegations that the company improperly failed to reflect climate change’s costs in its bookkeeping.

The judge presiding over the case, Barry Ostrager, ordered the state and the Exxon lawyers to come together outside of court to agree on a procedure for how the emails sent from the “Tracker” account would be handled.

Earlier this month, when news broke that Tillerson had used the second email, late night comedians and the press ran away with the story, with some suggesting that the use of the partial alias is evidence of misbehavior at Exxon. The company’s lawyers say they never hid the second email address’s existence, or the fact that Tillerson was its primary user. They say Tillerson used the email address to streamline communications with other top executives at the company. Moreover, the company had already turned over emails from the Tracker account to Schneiderman’s office as far back as February 2016.

Complicating the situation is Exxon’s admission that somewhere between three months to a year’s worth of the Tracker emails may be missing because of what they say was a glitch in how the account was set up. The state expressed skepticism of those claims and called on the judge to allow them to bring in experts to do a forensic search of Exxon’s servers.

“We’re not dealing with a forensic analysis here […] not yet,” said the judge, before instructing the lawyers to try to work out a solution on their own.

Though they did not repeat the accusation in court, the elite law firm that represents Exxon—Paul, Weiss, Rifkind, Wharton & Garrison LLP—have filed documents arguing that the attorney general’s office purposely sent a public letter about the second email address to create a public spectacle (rather than request the documents from the Exxon attorneys directly).

“We’ve given them everything they want,” said an attorney for the defense. Exxon’s lawyers promised to continue to comply with the subpoena, and said that more documents are forthcoming. The Exxon team agreed to work to meet a March 31st deadline set today by the court to finish turning over newly discovered documents.

The allegations that Schneiderman’s motives have more to do with politics than the law are not new and they are not just rhetoric. Last year, Exxon filed motions in federal court in Texas seeking to bring a halt to the New York Attorney General’s investigation. Rep. Lamar Smith, R-Texas, also subpoenaed information about the investigation’s origins from Washington. Smith has argued that Schneiderman’s decision to investigate came from a desire to please the environmental lobby.

While those attempts to stymie Schneiderman’s investigation have not been successful, they have put the New York and Massachusetts attorneys general on the defensive at times in recent months. Exxon has signaled that it does not intend to back down from what it sees as bullying by state officials looking to make a name for themselves.

In New York especially, the attorney general, which is an elected position, is seen as a springboard for higher office. The previous two attorneys general, Democrats Eliot Spitzer and Andrew Cuomo, both went on to be elected governor. In fact, a report from last September revealed that Schneiderman reached out to billionaire climate activist Tom Steyer shortly after launching the probe into Exxon. An email stated that the call was in regards to Schneiderman’s “race for governor.”

Following the hearing, representatives from the attorney general’s office, speaking on background, disputed the claim that the case was being tried in the press.