SPOILER ALERT: Do not read if you haven’t seen the final episode of HBO’s “The Jinx: The Life and Deaths of Robert Durst.”

The arrest of Robert Durst heightened the drama surrounding the final installment of HBO’s six-part documentary series “The Jinx: The Life and Deaths of Robert Durst,” investigating the twisted history of the real estate heir suspected of committing three murders.

But even without the real-life law enforcement action, there was plenty of drama in the closing moments of the 40-minute episode.

“Chapter 6: What the Hell Did I Do?” unfolds as a tense cat-and-mouse game between filmmakers Andrew Jarecki and Marc Smerling and Durst, whose bizarre life story over the past 30 years is truly stranger than fiction.

The episode details the filmmakers’ efforts to get Durst to sit for a final interview where they present him with a powerful piece of evidence tying him to the murder of his friend Susan Berman in 2000. The first half of the episode shows them going to a forensic document analyst to corroborate a fateful piece of handwriting evidence revealed in last week’s episode. But the real Perry Mason moment comes in the closing minutes, after Jarecki has put the evidence in front of Durst and the camera watches him squirm.

Even after Jarecki presents what appears to be conclusive evidence that Durst wrote the note that tipped off Beverly Hills police to the murder of Berman — which Durst denies — the interview ends with the pair shaking hands as they say goodbye. Another production staffer even offers to wrap up a sandwich for Durst to take with him. But as Durst excuses himself to use the bathroom, his microphone is still live and recording, and while mumbling to himself he appears to acknowledge that he has been trapped by the evidence.

“There it is. You’re caught,” Durst says to himself. “What a disaster.”

He continues: “He was right, I was wrong” — presumably referring to the advice his lawyer, Chip Lewis, expressed on camera earlier in the episode — namely, that Durst’s participation in “Jinx” could bring renewed legal scrutiny of the Berman murder and the others.

“What the hell did I do?” Durst says. “Killed them all, of course.”

Durst’s comments fall short of an unambiguous confession, but it is clear that the information revealed in the documentary series spurred his arrest for the Berman murder on Saturday while he was in New Orleans.

According to the New York Times, Jarecki and Smerling began talking to law enforcement officials in 2013 but had to walk a fine line between their journalistic pursuit and the desire to help investigators in the long-cold cases.

The Times also reported that Jarecki and Smerling didn’t discover that they had the audio recording of Durst’s rambling, damning comments in the bathroom until two years after the interview was conducted.

Jarecki’s reps said the filmmakers would not comment on the “Jinx” finale until Monday.