Editor's note: Jeffrey Epstein was arrested in New York on July 6, 2019, and faced federal charges of sex trafficking and conspiracy to commit sex trafficking. On August 10, 2019, he died in an apparent jailhouse suicide. For more information, see The Daily Beast's reporting here.

Ace lawyer Alan Dershowitz is looking to turn the tables on the woman who once tagged him in court as a child molester.

Dershowitz—along with Britain’s Prince Andrew—was accused of treating teenagers like “sex slaves” in a lawsuit involving their friend, billionaire financier and convicted pedophile Jeffrey Epstein.

But on Tuesday, Dershowitz and Prince Andrew scored a major victory in a Florida federal court after a judge outlawed all “lurid” sex allegations against them from the record from one alleged victim, referred to as “Jane Doe #3.”

Now Dershowitz is determined to go on the offensive. He’s filed a counterclaim against her legal team for defamation, The Daily Beast has learned—accusing the attorneys of defamation themselves. And the lawyer won’t sleep until the accuser is tossed behind bars.

Despite the aggressive action, Dershowitz may not be out of legal danger just yet, however.

U.S. District Court Judge Kenneth Marra ruled that “the factual details regarding with whom and where the Jane Does engaged in sexual activities are immaterial and impertinent to this central claim.”

But Jack Scarola, who represents the Jane Doe attorneys, said the judge’s decision was “no victory for Dershowitz.” He said that while Marra shot down the sex allegations as immaterial, “the court specifically left open the possibility for consideration of those details at a later stage in the proceedings.”

In other words, the sordid sex allegations could crop up again—especially if Jane Doe #3 testifies about the sex with the men or other alleged victims come forward and join the suit against Epstein.

What’s more, a secret plea deal between the federal government and Epstein’s lawyers could be in danger of being overturned, because the alleged sex victims claim they were shielded from knowing all the facts. That’s a problem, potentially, for Dershowitz and Prince Andrew, as the deal also granted immunity to his potential co-conspirators.

Dershowitz doesn’t see danger ahead, though. He says that from now on anybody airing the charges of sexual impropriety in court will face sanctions. “There’s no way they can get any of it into evidence at all under these circumstances,” he told The Daily Beast. “If they try to bring it up in court we’re going to seek contempt proceedings against them.”

“The ultimate goal is for [Jane Doe #3] to go to prison for perjury,” Dershowitz added, of the woman he’s referred to in the past as a “serial liar.”

Jane Doe #3 claimed in legal papers filed in Florida that when she was 16 years old she was “frequently sexually abused” by Dershowitz and Prince Andrew, among others.

In court papers filed on Dec. 30, 2014, she claimed to have had sexual relations “with Dershowitz on numerous occasions while she was a minor, not only in Florida but also on private planes, in New York, New Mexico, and the U.S. Virgin Islands.”

The accuser claimed Dershowitz not only engaged in these illegal trysts at Epstein’s homes but that he also “was an eyewitness to the sexual abuse of many other minors by Epstein and several other Epstein’s co-conspirators.”

The most damning allegations, however, may stem from the time when Dershowitz served as Epstein’s trusted lawyer. The billionaire was ultimately convicted and served 13 months of an 18-month sentence for soliciting prostitutes in Palm Beach—a relatively light sentence. “Dershowitz helped negotiate an agreement that provided immunity from federal prosecution in the Southern District of Florida not only to Epstein, but also to ‘any potential co-conspirators of Epstein,’” the lawyers for the accusers wrote in legal papers they filed.

Dershowitz said his legal team this week hired a private eye to track down Jane Doe #3 in Colorado to serve her a subpoena to compel her to testify under oath in the defamation lawsuit against him.

“She was trying not to be served but we found her in Colorado,” Dershowitz said. “We had an investigator find her.”

Now Jane Doe #3 has been served, and she will be forced to speak under oath. “If she repeats she had sex with me on Epstein’s ranch in New Mexico where I was at for one hour in the presence of five people, she will have committed perjury,” Dershowitz said.

“If she says I had sex with her on Jeffrey Epstein’s island where I was one day with my wife, my daughter, professor Michael Porter, his wife, and four members of his family,” he added, “she will be committing perjury.”

The subpoena is part of a series of legal salvos fired off by the lawyers fighting for each side in a sensational case that centers around a billionaire pedophile and his high-powered friends who may or may not have been participating in alleged misdeeds at his various mansions.

One of them was Prince Andrew, the Duke of York, who was photographed with Jane Doe #3 but has rejected the allegations that he slept with her.

A Buckingham Palace spokesman in January gave a flat out denial that Prince Andrew had engaged in any sexual acts with Jane Doe #3: “It is emphatically denied that The Duke of York had any form of sexual contact or relationship with [her]. Any claim to the contrary is false and without foundation.”

On Tuesday, a Buckingham Palace spokesman confirmed that while Prince Andrew was away on vacation for the week, “The Duke has been informed of the latest developments” in Florida.

Dershowitz’s 26-page defamation counterclaim is a response to Jane Doe #3’s lawsuit against him.

In it, Dershowitz rips lawyers Bradley Edwards and Paul Cassell as showing “reckless disregard” for their various Jane Doe clients. In the document they filed last month, Dershowitz says, the lawyers tried to “expose Dershowitz to hatred, ridicule, and contempt,” and ultimately “injure his sterling personal reputations.” Dershowitz also contends, among other grievances, that he’s taken a monetary hit “in the form of lost clients and lost speaking engagements.”

Edwards and Cassell responded by trying to get the judge to dismiss Dershowitz’s counterclaims. In their response, they pointed out that their clients’ rights were shorted by the federal government when they agreed to the “secret plea deal” that “violated their rights under the Crime Victims Rights Act.”

Dershowitz will get his day to be deposed—exactly when could be determined as early as Friday. So too will his accuser, now that she’s been subpoenaed. In Edwards’s and Cassell’s defamation lawsuit against Dershowitz, all the lawyers and four Jane Does will be asked to give testimony under oath.

So could others. Judge Marra’s decision holds the door open for “similarly situated victims” who could have been violated by Epstein to come forward.

And the plea deal Dershowitz helped negotiate for his former friend Epstein back in 2006 could be invalidated if the judge believes that the Jane Does were kept in the dark about certain facts, as Edwards and Cassell contend.

If that agreement is overturned, then Epstein and anybody who is a possible co-conspirator would lose immunity and could face charges for the alleged rapes.

And there are still outstanding questions about the backend correspondence that occurred, involving the government and Epstein’s legal team.

It took thousands of documents (including emails between Epstein’s lawyers and state and federal attorneys) to hash out a plea deal for the billionaire. The convicted sex offender’s lawyers want that information to be sealed “until the court can make a considered determination of these traditionally confidential plea negotiations should be made part of this public record.”

But Dershowitz says he hopes every piece of paper is released publicly. “Personally, I hope everything to be produced,” he said. “I don’t want any secret. Nothing. Everything, from my point of view, everything should be produced.”