By John D. McKinnon 

WASHINGTON--A federal judge threatened to hold the Internal Revenue Service Commissioner John Koskinen in contempt of court on Wednesday, after the agency didn't comply with an order to provide documents in a case about its alleged targeting of conservative groups.

U.S. District Judge Emmet Sullivan issued the order at a status hearing in the case brought by the conservative activist group Judicial Watch. The lawsuit, brought under the Freedom of Information Act, seeks documents related to alleged IRS targeting of nonprofit groups as they applied for tax-exempt status starting in 2010.

Judge Sullivan ordered the IRS on July 1 to start turning over newly-discovered emails on a weekly basis, and Judicial Watch complained that the IRS was slow to respond. The emails were from Lois Lerner, a now-retired IRS official who has been at the center of congressional investigations. Ms. Lerner has denied any wrongdoing.

"In the event of noncompliance with future court orders, the commissioner of the IRS and others shall be directed to show cause as to why they should not be held in contempt of court," the judge said, according to official minutes of the hearing.

"Of course, the IRS will comply with the judge's order," the IRS said in a written statement.

The contempt threat is just the latest headache for Mr. Koskinen. In fact, it is the second contempt threat he has received just this week.

On Monday, House Oversight Chairman Jason Chaffetz (R., Utah) wrote a letter to President Barack Obama, urging him to remove Mr. Koskinen from office. The move raised the possibility lawmakers would seek to hold Mr. Koskinen in contempt of Congress, or attempt to impeach him.

GOP lawmakers are unhappy over a series of events that blocked them from getting information for their own IRS targeting probes.

Democrats, including the Obama administration, continue to vigorously defend Mr. Koskinen, a veteran turnaround specialist who took over the IRS in late 2013.

Write to John D. McKinnon at john.mckinnon@wsj.com