A federal judge has ordered the IRS to explain "under oath" how the agency lost a trove of emails from the official at the heart of the Tea Party targeting scandal.

U.S. District Judge Emmet G. Sullivan gave the tax agency 30 days to file a declaration by an "appropriate official" to address the computer issues with ex-official Lois Lerner.

The decision came Thursday as part of a Freedom of Information Act lawsuit by conservative watchdog group Judicial Watch, which along with GOP lawmakers on Capitol Hill has questioned how the IRS lost the emails and, in some cases, had no apparent way to retrieve them.

The IRS first acknowledged it lost the emails in a letter to senators last month.

"In our view, there has been a cover-up that has been going on," Judicial Watch President Tom Fitton said. "The Department of Justice, the IRS, had an obligation, an absolute obligation ... to alert the court and alert Judicial Watch as soon as they knew when these records were supposedly lost."

More On This...

The IRS says it lost the emails in 2011 when Lerner's computer crashed. At the time, Lerner headed the IRS division that processes applications for tax-exempt status. She has since retired.

During the court hearing, Sullivan indicated he wanted the portion of the declaration on the computer issues to be wide-ranging, saying "that's about as broad as I can make it."

It also emerged at the status hearing that a Treasury Department inspector general probe into the matter is underway.

The lawyer representing the IRS, Geoffrey Klimas, argued that any further discovery in this case might impede the IG's investigation.

Sullivan seemed leery of that argument and also asked that the IRS official speak to that subject in the explanation the agency submits.

Further, Sullivan ordered that the IRS official explain how Lerner's files may be recovered through "other sources."

Fox News' Jake Gibson and Peter Doocy and The Associated Press contributed to this report.