A judge officially dismissed a lawsuit against Kevin Spacey brought on by an anonymous accuser after they failed to disclose their identity to the court. 

Fox News can confirm that Judge Lewis Kaplan has officially dismissed the lawsuit brought on by an unnamed accuser known as "C.D." who accused the 61-year-old "House of Cards" actor of sexually abusing him in the 1980s when he was underage.

According to court documents viewed by Fox News, Spacey’s attorneys sought to dismiss the case entirely after the judge ruled on May 3 that C.D. could not move forward with his lawsuit if he remained unwilling to disclose his identity

C.D. was given 10 days to amend his complaint and include his name. According to the court documents, on the tenth day, he issued a letter informing the court that he would not be disclosing his identity and that he understood the consequences of that decision, leading to the judge to officially dismiss the case Thursday.

KEVIN SPACEY ACCUSED OF GROPING 'HOUSE OF CARDS' PRODUCTION ASSISTANT: REPORT

In an early March letter to the judge, attorney Peter Saghir said C.D. feels "extreme anxiety and psychological distress at even the thought of being required to proceed publicly" and had reluctantly decided to drop his claims if Kaplan ordered him to proceed publicly.

A lawsuit against Kevin Spacey was dismissed. (Daniel Zuchnik/WireImage)

The man had reportedly met Spacey in the actor's suburban New York acting class before the alleged abuse, according to the lawsuit, which sought more than $40 million in damages. 

At the time of his initial ruling on the matter, Kaplan said C.D.’s privacy interest did not outweigh the presumption of open judicial proceedings and the prejudice to Spacey's defense that would occur if he could proceed anonymously. Individuals with information that might support Spacey also would not know to come forward, the judge added at the time.

C.D. since the 1990s had spoken to an unknown number of people about his claims against Spacey and had apparently cooperated for a New York Magazine article that appeared on Vulture in November 2017, Kaplan said.

KEVIN SPACEY SUED BY ANTHONY RAPP, ANOTHER PLAINTIFF FOR ALLEGED SEXUAL ASSAULT IN 1980S: DOCS

He said at the time "the evidence suggests that C.D. knowingly and repeatedly took the risk that any of these individuals at one point or another would reveal his true identity in a manner that would bring that identity to wide public attention."

Kaplan noted that C.D. also recruited for the lawsuit his co-plaintiff, Anthony Rapp, who has appeared in "Rent" on Broadway and in "Star Trek: Discovery" on television. The lawsuit said the older actor made a sexual advance to a teenage Rapp at a 1980s party, allegations he himself detailed in 2017 that kicked off public scrutiny of Spacey's past.

Kevin Spacey was initially accused of sexual misconduct by ‘Star Trek: Discovery’ actor Anthony Rapp. (Getty)

CLICK HERE TO SIGN UP FOR OUR ENTERTAINMENT NEWSLETTER

When Rapp first spoke publicly of his claim, others went public too and Spacey’s then-celebrated career abruptly halted. At the time, Spacey issued a statement saying he didn’t remember the encounter but apologized.

CLICK HERE TO GET THE FOX NEWS APP

The judge said claims by C.D.'s lawyers that using their client's name would trigger post traumatic stress disorder and the anxiety, nightmares and depression that come with it is a consequence that likely cannot be prevented as the case proceeds and C.D. is ultimately forced to testify in public.

The Associated Press contributed to this report.