LOS ANGELES — A judge on Friday delayed a civil lawsuit by porn actress Stormy Daniels against President Donald Trump and his personal lawyer, Michael Cohen, citing a criminal investigation the attorney is facing.

U.S. District Judge S. James Otero agreed to put the case on hold for three months and set a hearing for July 27.

Cohen asked for a delay after FBI agents raided his home and office earlier this month. The FBI was seeking records about a nondisclosure agreement Daniels signed days before the 2016 presidential election.

Daniels, whose real name is Stephanie Clifford, has said she had an affair with Trump in 2006 and sued to dissolve a confidentiality agreement that prevents her from discussing it. She’s also suing Cohen, alleging defamation.

Cohen’s attorney said in court last week that because the criminal investigation overlaps with issues in the lawsuit, his client’s right against self-incrimination could be adversely impacted because he won’t be able to respond and defend himself.

Otero agreed, ruling that “there is a large potential factual overlap between the civil and criminal proceedings that would heavily implicate Mr. Cohen’s Fifth Amendment rights.”

Daniels’ attorney, Michael Avenatti, tweeted that he’d likely be filing an immediate appeal of Otero’s ruling with the 9th U.S. Circuit Court of Appeals.

“We do not agree with it,” Avenatti wrote. “Justice delayed is justice denied.”

While Otero agreed with Avenatti that Cohen’s argument for delay was made weaker without an indictment being filed against him, “the significance of the FBI raid can’t be understated.”

“This is no simple criminal investigation,” Otero wrote. “It is an investigation into the personal attorney of a sitting president regarding documents that might be subject to the attorney-client privilege.”

He continued to say that “whether or not an indictment is forthcoming, and the court thinks it is likely based on these facts alone, these unique circumstances counsel in favor of stay.”

Cohen said in court records that FBI agents had seized his electronic devices and documents that contain information about the $130,000 Daniels was paid as part of the agreement. Agents also seized communications with his lawyer, Brent Blakely, about the civil case, Cohen said.

Daniels has offered to return the $130,000 and argues the agreement is legally invalid because it was only signed by her and Cohen, not by Trump.

Cohen, who has denied there was ever an affair between Daniels and Trump, said he paid the money out of his pocket using a home equity loan. He has said neither the Trump Organization nor the Trump campaign was a party to the transaction with Daniels and he was not reimbursed for the payment.

Trump answered questions about Daniels for the first time earlier this month and said he had no knowledge of the payment made by Cohen and didn’t know where Cohen had gotten the money. The White House has repeatedly said Trump denies the affair.

Trump said Thursday that Cohen handles very little of his legal work, but did represent him in the “crazy Stormy Daniels deal.”

Otero also ruled that Daniels’ would not be substantially impacted by a delay, writing that she “has already appeared on at least two national shows … to tell her alleged story.”

“The court agrees that (Daniels) has not established that she has actually been deterred from speaking, or that a delay in proceedings would cause undue prejudice,” he wrote.

Cohen’s attorneys have accused Daniels of violating the confidentiality clauses more than 20 times and said she could be liable for $1 million in damages for each violation.