Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

On the eve of Oklahoma Attorney General Scott Pruitt's confirmation vote to be head of the Environmental Protection Agency, a judge from the Sooner State ordered the release of thousands of emails between his office and fossil fuel companies.

Oklahoma County District Judge Aletia Haynes Timmons told Pruitt's office that it would have to hand over the emails to the Center for Media and Democracy, or CMD, which requested the first batch of documents in 2014, or to the court.

Scott Pruitt testifies before the Senate Environment and Public Works Committee last month in Washington, D.C., on his nomination to head the Environmental Protection Agency. Michael Reynolds / EPA

According to the court filing, the CMD alleged that Pruitt and his office continued "to deny access to specific requested public records in violation of the Oklahoma Open Records Act" after it had filed more than eight requests.

Timmons agreed, finding that "there was an abject failure to provide prompt and reasonable access to documents requested."

The liberal watchdog group had asked for the correspondence between Pruitt's office and Koch Industries, mining and drill companies and the Republican Attorneys General Association, according to the CMD's general counsel, Arn Pearson.

"Those are the types of things we're looking for that go toward his conflicts of interest and whether he'll be carrying out the agenda of fossil fuel companies and not carrying out the EPA's mandate," Pearson said.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

At the time of the hearing on Thursday, the attorney general's office had provided only 411 of the more than 3,000 emails the CMD had requested. The office turned over the 411 emails earlier this week, although the group filed its first request two years ago.

"They said they had a first-come, first-served system and kept saying they had a huge request ahead of ours," Pearson said. "We were stonewalled for a little over two years and decided to file suit on February 7."

Pruitt's office maintained that it had committed no wrongdoing and was only following the "first-come, first-served system."

"The Office of Attorney General remains committed to following the letter and spirit of the Open Records Act," said Pruitt's press secretary, Lincoln Ferguson. "In light of that, we are reviewing all of our options in order to ensure fairness to all requestors rather than elevating the importance of some requests over others."​​

But the CMD and Pearson said Pruitt's office intentionally withheld documents. Of the 411 emails it received for its initial request, the investigative group identified 27 that had been provided to The New York Times in a 2014 Pulitzer Prize-winning investigation that revealed that Pruitt had taken fracking rules drafted by Devon Energy, an Oklahoma oil company, and passed them as his own.

Sen. Sheldon Whitehouse, D-Rhode Island, brought up the more than 50 unresolved Open Records Act requests given to Pruitt's office during his EPA confirmation hearings. Whitehouse said the lack of transparency was one of the reasons that Democrats opposed Pruitt's nomination.

Oklahoma judge just ordered the release of thousands of emails from EPA nominee Scott Pruitt. Delay this vote until we see the emails! — Brian Schatz (@brianschatz) February 16, 2017

Those emails might show corruption - so of course Republicans are jamming his confirmation through 4 days before the emails become public. — Elizabeth Warren (@SenWarren) February 16, 2017

Nevertheless — regardless of the judge's ruling, the substance of the emails or Democratic opposition — Pruitt is expected to sail through the confirmation vote on Friday. Democrats are a minority in the Senate, 48-52, and only one Republican, Susan Collins of Maine, has said she will not support Pruitt's candidacy.

Related: Senate Panel Approves EPA Critic Scott Pruitt to Head Agency

Even so, Democrats said the judge's ruling is a good enough reason for the vote to be postponed until they are able to read the emails.

"This development really requires a delay in this vote," Sen. Richard Blumenthal, D-Connecticut, said Thursday on the Senate floor. "We have an obligation in advising and consenting to be as fully informed as possible."

Environmental organizations agreed with the senators.

The Senate should not vote on Scott Pruitt's EPA confirmation until the public has a chance to see these emails. https://t.co/FzeXTQSsvH https://t.co/8Eba3gN6tG — NRDC (@NRDC) February 16, 2017

"Scott Pruitt and Senate Republicans have made a mockery of the confirmation process, permitting the nominee to escape scrutiny and hide his deep ties to the fossil fuel industry," Sierra Club Legislative Director Melinda Pierce said in a statement. "What is he hiding in all of these emails?

"The vote to confirm Pruitt must now be delayed until every senator can see just who Pruitt is and what he will do if permitted to run the EPA," Pierce said.