robert durst
'The Jinx' star had confessed to killing Susan Berman, 'secret witness' testified on Feb.16, 2017. In this photo, Real estate heir Robert Durst waived extradition to Los Angeles in a court appearance in New Orleans. He's pictured here during his trial on charges of trespassing on property owned by his estranged family, in New York, Dec. 10, 2014. REUTERS/Mike Segar

Robert Durst's longtime friend Nick Chavin testified Thursday in a Los Angeles court that Durst had confessed outside a New York restaurant in late 2014 that he had killed his friend, Susan Berman, 14 years ago.

Chavin's identity was kept secret until Wednesday before he actually took the stand in court. He feared that his life would have been in danger because of his testimony. Los Angeles Superior Court Judge Mark Windham had allowed Chavin and another witness to keep their testimonies recorded on videotape, if they die before Durst's trial.

In 2014, Chavin and Durst had been together for dinner and they talked about two women whom they both knew and had disappeared from their lives. Among them were Durst's first wife, Kathleen, and a writer friend Susan Berman they had both been close with.

Durst had earlier been suspected for his first wife's disappearance and also killing Berman. According to Chavin's testimony, after they had gone out of the restaurant, Durst had raised the issue.

"We walk out the door and on the sidewalk I said, You wanted to talk about Susan? And Bob said, 'I had to. It was her or me. I had no choice,'" Chavin reportedly said in his testimony.

"He turned to walk away. I said, 'You wanted to talk about Kathie?' And he continued to walk away. Nothing more was said," Chavin added.

Durst, 70, was arrested in New Orleans in 2015 and has been charged with first-degree murder in Berman's death. He has pleaded not guilty of the murder. Although Durst was questioned during the probe for the disappearance of Kathleen, no one has been charged for her death because her body was never found.

Prosecutors said that Berman had been shot in the back of her head at her Benedict Canyon, Los Angeles, home in 2000 because Durst feared that Berman would speak to investigators about his wife's 1982 disappearance.

Chavin, in his testimony, also specified that Kathleen and Durst's relationship was "strained."

"She said she was afraid of him. She never said he would hurt her but she was afraid of him," Chavin reportedly testified.

The HBO documentary, "The Jinx," focused on the links Durst had to the disappearance of his first wife, the death of Berman and the dismemberment of a 71-year-old neighbor. Durst became quite well-known after the show premiered in February 2015.

On the last day of the shoot of the show, Durst was unaware that he had been wearing a mic when he confessed to several killings while talking to himself.

"There it is, you're caught," he reportedly said. "What the hell did I do? Killed them all, of course," he added.