LOS ANGELES -- Robert Durst's close friend reluctantly admitted Friday that he had misled and lied to prosecutors for months before coming clean and saying that the real estate heir had confessed to killing their close friend.

A dogged defence lawyer finally got Nathan Chavin to say he was "lying" after he had deftly wielded an arsenal of weaker synonyms to explain what he said were efforts to avoid turning on his friend by telling the truth.

"I was covering up. I was withholding the truth," Chavin said. "Is that a euphemism? I was lying."

Evidence of Chavin's "waffling," a word he employed at one point, was used by Durst's camp to undermine the prosecution's star witness after he dropped two damning bombshells the day before.

Chavin said Berman, their mutual close friend, told him years ago that Durst confided in her that he killed his first wife, Kathleen Durst, who disappeared in 1982 and has never been found. Chavin said Durst told him outside a New York restaurant in 2014 what he took to be a confession to Berman's killing.

"It was her or me," Durst said about Berman, according to Chavin. "I had no choice."

Durst, 73, has pleaded not guilty to murder in the fatal shooting of Berman in her Los Angeles home. Authorities have long suspected he killed Kathleen Durst, but he's never been charged with any crime related to her disappearance.

Chavin's testimony came in a rare hearing to record witnesses who are elderly or fear the millionaire could have them whacked. The testimony that concluded Friday would only be used at a future trial if they are dead or couldn't appear for some other reason.

The defence said Durst poses no threat. He's frail, shuffles into court slowly and he's in jail where his phone conversations are recorded.

But prosecutors say that Durst killed Berman as she was preparing to speak with police who had reopened the investigation into Kathleen Durst's disappearance in New York.

Chavin's identity was disclosed to the defence just two weeks before the hearing and he was on a plane to California that same day. He has been guarded by members of an elite division of the Los Angeles Police Department.

The battle over truth and lies played out against a backdrop of deeper themes: loyalty and betrayal.

Chavin said he struggled to balance his allegiances to two best friends before deciding to tell "the whole truth" about what he knew about Berman's death.

Berman had once found herself in that position, he said, after she learned that Durst killed his wife.

"Kathie's gone and we can't help her, we have to help Bob," Berman had said, according to Chavin.

Chavin had said Berman would do anything for Durst, and so would he.

In one recorded phone call played in court, Deputy District Attorney John Lewin asked if he thought Berman would have ultimately told the truth about Durst.

"I don't think she would have lied under oath," Chavin said.

"If that's the case it looks like Bob (Durst) made an intelligent decision," Lewin cracked. "It looks like Bob decided he had loose ends he couldn't have out there."

In the end, Chavin decided Berman deserved more of his loyalty than Durst.

"I had to consider my obligation to Susan," Chavin said. "I had a duty to protect her memory like she had to protect Bob."

Durst's lawyer suggested Chavin fabricated the so-called confession to curry favour with Douglas Durst, who ran the family's New York real estate development empire, feared his older brother and wanted him behind bars.

Chavin, an ad executive, told prosecutors he was making a major pitch to the firm and that his business depended on maintaining goodwill with Douglas Durst, who hates his brother.

He was asked by Lewin on one recording if his knowledge of a confession would put him in the good graces of Douglas Durst.

"It sure would," he said. "But it would make me a liar."

Durst was arrested in New Orleans in 2015 just before the final episode aired of the six-part HBO series, "The Jinx: The Life and Deaths of Robert Durst."

After the arrest, Durst called Chavin from jail and said he regretted participating in the documentary that dredged up new evidence and ended with him muttering to himself on a live microphone: "You're caught! What the hell did I do? Killed them all, of course."

On the jailhouse call, Durst said the filmmaker had put him behind bars.

Durst said it was "unbelievable how stupid I could be."

Chavin reminded Durst that he counselled him not to participate in the project.