NEW YORK/WASHINGTON (Reuters) - U.S. President Donald Trump distanced himself from his longtime personal lawyer Michael Cohen on Thursday, hours before a judge ruled that documents seized from Cohen by the FBI should be reviewed by an independent court-appointed official.

The appointment of former judge Barbara Jones as a “special master,” to review the documents and decide which ones prosecutors should be allowed to see, was essentially a compromise that both prosecutors and Cohen’s lawyers had said they would be open to, even though that option was not their first choice.

The FBI raided Cohen’s office and home on April 9, infuriating Trump. Prosecutors said they had been investigating the lawyer for months, largely over his business dealings rather than his legal work.

Once they receive the documents from Jones, prosecutors could use them in their case.

It is not clear if those documents pertain to Trump’s business dealings. But earlier on Thursday in an interview with Fox News, Trump said Cohen had handled only “a tiny, tiny little fraction” of his overall legal work.

He said the investigation “doesn’t have to do with me” and “they’re looking at something having to do with his business. I have nothing to do with his business.”

Trump, who has said little publicly about an adult-film star who says she was paid to stay silent about a one-night stand she had with Trump in 2006, also confirmed for the first time that Cohen had represented him in “this crazy Stormy Daniels deal.”

Trump and Cohen have sought to limit which of the seized documents prosecutors could see, citing attorney-client privilege.

The prosecutors initially said the documents should be reviewed by 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.

U.S. District Judge Kimba Wood instead decided at an hour-long hearing on Thursday to opt to ask a special master to see the documents first.

The prosecutors have begun to turn all of the seized materials over to Jones, who will review them to determine what is protected by attorney-client privilege. Lawyers for Cohen and Trump will be able to review in tandem, so they can object to Jones’ decisions if they disagree, the judge said.

The parties are due back in court to check in on the progress on May 24. Without setting a specific deadline, Wood indicated she may intervene if it were going too slowly.

Jones has served in a similar role in a number of other matters. In 2016, she was appointed the independent review officer for the International Brotherhood of Teamsters to hear corruption charges at the labor union, and has overseen corporate compliance cases.

FILE PHOTO: U.S. President Donald Trump's personal lawyer Michael Cohen leaves federal court in the Manhattan borough of New York City, New York, U.S., April 16, 2018. REUTERS/Lucas Jackson

Prosecutors have said they do not believe the papers are likely to contain many privileged documents related to Trump. In a court filing on Thursday morning, they cited Trump’s comment that Cohen handled only a small part of his legal work.

Cohen has admitted paying $130,000 to Daniels, whose real name is Stephanie Clifford, before the 2016 election to secure her silence about having sex with Trump, which he denies. Cohen said the payment was legal, and Daniels has sued to end her nondisclosure agreement.

Prosecutors are investigating Cohen for possible bank and tax fraud, possible campaign law violations linked to the 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 inquiry into possible collusion between Trump’s 2016 presidential campaign and Russia, something that Trump has repeatedly denied.