A federal judge ruled on Thursday that a court-appointed independent official called a special master should be the first to examine documents seized by FBI agents from U.S. President Donald Trump's personal lawyer, Michael Cohen.

The agents raided Cohen's office and home on April 9, an action that infuriated the president. Prosecutors said they have been investigating the lawyer for months, largely over his business dealings rather than his legal work.

The seizure of the documents has led to a legal spat as to who should be allowed to review them, with lawyers for Cohen and Trump seeking to limit what prosecutors could see, citing attorney-client privilege.

In an interview with Fox News on Thursday, Trump called Cohen a good guy but said he handled only "a tiny, tiny little fraction" of his overall legal work.

The prosecutors initially said the documents should be reviewed by a "taint team" of lawyers within their own office, who would be walled off from the main prosecution team. Cohen argued that his lawyers should get a first look.

In the end, the judge ruled that an independent special master should get a first look, an option that both sides had indicated they would be open to.

They're looking at something having to do with his business. I have nothing to do with his business. - U.S. President Donald Trump

Barbara Jones, a former federal judge in the Southern District of New York who has overseen cases ranging from organized crime to corporate compliance, will decide which of the documents should be handed over to prosecutors.

Jones will review the documents and determine which may be shielded by attorney-client privilege.

"The letters I received from counsel for Mr. Cohen and the intervenors has convinced me that this process can go quickly with the special master, assuming everyone works as hard as you have represented you will work," said U.S. District Judge Kimba Wood.

Cohen sat in court to hear the decision, wearing a dark suit, white shirt, and pale yellow tie.

Stephen Ryan, a lawyer for Cohen, called Jones "a wonderful choice" to be special master.

'Crazy deal'

In the Fox News interview, Trump said that he had nothing to do with the criminal investigation into the lawyer.

The Cohen probe "doesn't have to do with me," Trump said. "They're looking at something having to do with his business. I have nothing to do with his business."

Adult-film actress Stormy Daniels (whose real name is Stephanie Clifford) leaves the United States District Court Southern District of New York after a hearing related to Trump lawyer Michael Cohen on April 16. (Drew Angerer/Getty Images)

Trump also confirmed for the first time that Cohen had represented him in "this crazy Stormy Daniels deal," referring to an adult-film star who says she had a one-night stand with Trump in 2006.

Prosecutors are investigating Cohen for possible bank and tax fraud, possible campaign law violations in connection with a payment to Daniels, and perhaps other matters related to Trump's presidential campaign, a person familiar with the probe has said.

The investigation stemmed in part from special counsel Robert Mueller's probe into possible collusion between Trump's 2016 presidential campaign and Russia, something that Trump has repeatedly denied.

Cohen has admitted paying $130,000 US to Daniels, whose real name is Stephanie Clifford, before the 2016 election to secure her silence about the one-night stand she said she had with Trump. Cohen said the payment was legal, and Daniels has sued to end her nondisclosure agreement.

Trump, who has denied having an affair with Daniels, said Cohen did nothing wrong in representing him in the Daniels case.

"There were no campaign funds going into this, which would have been a problem," he told Fox.