New York City real estate heir Robert Durst took the stand for his fifth day of testimony in a trial over the murder of his longtime friend Susan Berman, who was shot in the back of the head in her Los Angeles home in 2000.

Durst admitted to lying about important details in the past and said hypothetically he might do so again.

But he also said he would have admitted to the murders of Berman, his ex-wife, a former neighbor, John F. Kennedy and John Lennon if it would have gotten him out of jail.

In one exchange, Los Angeles District Attorney John Lewin grilled Durst on whether he would lie if he needed to in order to save his own skin.

New York real estate scion Robert Durst, 78, answers questions from defense attorney Dick DeGuerin, left, while testifying in his murder trial at the Inglewood Courthouse on Monday, Aug. 9, 2021, in Inglewood, Calif. (Gary Coronado / Los Angeles Times via AP, Pool)

"If you had in fact killed Susan Berman, would you tell us?" Lewin asks.

ROBERT DURST TESTIFIES ABOUT LAST WEEKEND HE SAW WIFE KATHIE BEFORE SHE VANISHED

"No," Durst replies. In previous testimony, when asked if he killed her or knew who did, he answered "no" both times.

"If you’ve said you’ve taken an oath to tell the truth but you’ve also just told us that you would lie if you needed to," Lewin asked, "can you tell me how that would not destroy your credibility?"

"Because what I’m saying is mostly the truth," Durst replied. "There are certain things I would lie about, certain very important things."

While denying that he had killed his friend, he admitted to sending police a note about her remains and said he’d lied about that before because he thought people would think he’d killed her. 

He also said he’d lied about his whereabouts at the time of Berman’s death during a separate murder trial – in which he was acquitted in Texas.

And he said that if he had killed his wife, Kathie Durst, and murdered his former neighbor, Morris Black, he wouldn’t admit to the crimes.

Lewin grilled Durst on inconsistencies in his recounting of several "significant" memories and asked whether it would be "reasonable" to think Durst was lying about some of them.

Prosecutors share photo of Robert Durst (left), Susan Berman (middle) and Kathie Durst (right) at Robert Durst's Aug. 11 murder trial. (Fox News) (Fox News)

The defendant answered, "Yes."

The 78-year-old also testified about the HBO docuseries, "The Jinx," saying that he had followed "a script" during its filming and that not everything he said in the show was true.

The show examined the deaths of Berman, Durst’s ex-wife Kathie and Black, of whose murder he was acquitted on the grounds of self-defense.

Durst testified his lawyers had told him not to sit for interviews for "The Jinx" – and he said he was high on crystal meth during some of the filming early on. On the series finale, a clip aired of a hot-mic recording him saying "killed them all, of course," during a bathroom break.

After the show aired, he was arrested in connection with Berman’s shooting death.

Durst has pleaded not guilty and said during the trial that he did not kill Berman and does not know who did.

However while maintaining his innocence Tuesday, he slammed his own defense team and said the prosecution was doing a better job at trial.

Prosecutors allege that Durst killed Berman in order to keep her from speaking with police about the unsolved 1982 disappearance of Kathie Durst.

CLICK HERE TO GET THE FOX NEWS APP

Durst has not been charged in his wife’s death, and her body has not been found. But she was declared dead in 2017.

Durst was acquitted of murder after he said he fatally shot Black in self-defense – but he was convicted of destroying evidence by dismembering Black’s body and dumping it offshore in Galveston, Texas.

Fox News’ Laura Prabucki contributed to this report.