Prince Andrew's old friend, Alan Dershowitz, is trying to get him out of a jam with his sexual assault lawsuit ... by asking a judge to unseal some old legal docs involving Jeffrey Epstein.
As you'll recall ... Queen Elizabeth's son was sued last month by Virginia Roberts Giuffre, who claims she was a victim of Epstein's sex-trafficking scheme for powerful men, including guys like Prince Andrew and Dershowitz.
Giuffre also sued Dershowitz in 2019 and made similar accusations, but she recently dropped her battery claim against him. He says she dropped it because an old settlement she reached with Epstein in 2009 released him and others from certain liability ... meaning they can't be sued by her for the sexual claims.
According to new legal docs filed by Dershowitz ... this confidential settlement is the reason she had to drop the battery claim against him, and he believes it should apply to Prince Andrew too.
However, according to legal docs, Giuffre's lawyers claim they can't undo the confidentiality of the settlement because other parties were involved ... and Epstein's estate won't undo it either. So, Dershowitz is asking the judge to step in.
Dershowitz wants the judge to unseal the 2009 settlement with Giuffre -- or at least a redacted version of it -- so Prince Andrew can try to use it to get the sexual assault claims against him dropped.
Prince Andrew is accused of sexually abusing Giuffre in NYC when she was 17 as part of the alleged sex trafficking by Epstein and his accused co-conspirator, Ghislaine Maxwell.
"I don't remember this."
Prince Andrew says he has wracked his brains but cannot recall any incident involving Virginia Roberts.
Andrew was not cooperative with FBI and federal prosecutors in 2019 and 2020 -- when they wanted to talk to him about Epstein -- and in wake of Epstein's arrest and death in his jail cell, the Prince claimed he couldn't remember meeting Giuffre ... despite a 2001 photograph where he's apparently posing with her.
Prince Andrew retreated from all public roles in May 2020 over his ties to Epstein.