Anthony Weiner is the perfect subject for a documentary, in that he has enough self-awareness to reflect on his mistakes, but not nearly enough self-control to stop himself from making them, even, and perhaps especially, when the cameras are on him.

His decision to run for mayor of New York in 2013 is the meta-miscalculation that provides the structure for “Weiner,” Josh Kriegman and Elyse Steinberg’s spectacular new documentary about Weiner’s downfall in a sexting scandal, his attempted recovery from that scandal and the eventual destruction of his political future. (The movie is in limited release this weekend, and will air on Showtime this fall.)  And the other terrible choices he makes along the way — lying about the number of women with whom he exchanged racy texts, refusing to walk away from a heckler in a bakery on a walk through a Jewish neighborhood, flipping off the press on the way out of his concession speech — provide the movie with propulsive, and sometimes ghastly, momentum.

The risk with a documentary like “Weiner” is that close access can lead directors to sympathize with their subjects. But while Kriegman is a first-time director and Steinberg had previously directed an episode of television, Weiner doesn’t snow them, perhaps because the contradictions in his behavior are so glaringly apparent.

He wants forgiveness but sets himself up for further catastrophe by lying — or, as he tells Bret Baier in a clip, “I am reluctant to say anything definitively about this” — about his sexting when the scandal first breaks.”What was Huma’s [Abedin, Weiner’s wife] reaction when you told her?” someone asks Weiner early in the movie, probing one of the central questions that are inherent to any such scandal. “Told her the truth?” Weiner asks, reminding us of his dishonesty in an effort to come clean. He’s desperate to restore his dignity, but Weiner can’t stay out of fights, whether he’s jawing at rival Sal Albanese at a candidate forum or getting into that screaming match at the bakery. He wants both the mayoralty and his marriage but can’t accept that the pursuit of the former puts tremendous strain on the latter.

Women who stay with husbands who betray them are endless sources of fascination and speculation, especially when one half of the couple is in politics. And while fictionalized versions of Hillary Clinton have allowed artists and audiences to imagine their way inside that particular marriage, “Weiner” gets as close as I think any journalist or documentarian has ever come to being inside one of those marriages as the two people involved in it weather this sort of extreme strain.

If Weiner is almost wildly unrestrained in the presence of the cameras following him, Abedin is far more controlled. But even if she keeps her mouth in a carefully composed slash for much of the movie, it becomes clear that her continued pain at her husband’s behavior and the publicity around it — “It’s like living a nightmare,” she tells him at one point — is mingled with a certain contempt for his political instincts.

“I’m not going to do this if you’re going to make it unpleasant. I hate asking people for things,” Abedin snaps at Weiner after a fundraising call that goes badly. “I’m not crazy about those pants,” she tells him in an elevator. “You don’t know anything,” she shoots back at Weiner after he promises he’ll prep her for an event. She bluntly informs him “It was pretty bad” after he gets into a testy exchange with MSNBC host Lawrence O’Donnell. In a smart, effective editing choice, Kriegman and Steinberg interspersed MSNBC clips and the sight of Weiner delivering his rant to the empty studio from which he’s appearing on O’Donnell’s show; his venom looks bad in the clips, and worse in that awful, isolated blank space.

During a tense confrontation between Weiner and his campaign staff, intended to clear the air after they learn how much Weiner had lied to them, it’s Abedin who thinks to tell communications director Barbara Morgan that when she leaves the building and confronts the press, “You will look happy. I’m saying this for you. I don’t want it to be the press secretary walked out very unhappy.” (Morgan’s trials are a critically important subplot of “Weiner”; the moment when Weiner tells Morgan that they won’t be denying new allegations against him is quietly devastating.)

If it’s shocking that Weiner and Abedin agreed to this project in the first place, and then stuck with it even as the campaign unfolded into a disaster, “Weiner” adds a gratifying resistance to the idea that all the parties to this sorry drama need to be slotted into preexisting roles in the narrative.

Sydney Leathers, one of the women Weiner had texted, parlaying the affair into a Howard Stern appearance and a deal to make sex tape, told the New York Daily News that she expected that the film would have “me shown to look like the villain.” But “Weiner” doesn’t really do that. Especially in a moment when Leathers chases Weiner and his aides through a McDonald’s, trying to confront him at the party that marks the end of his campaign, she seems vulnerable and maybe a little naive. “Seriously? All to avoid a 23-year-old? Really?” she asks, of Weiner’s evasive maneuvers. Whether she actually doesn’t get it, or is playing dumb, Leathers comes as across as complicit in her own disposable role in the news cycle, a verdict that inspires more pity than anger.

“The punchline is true about me. I did the things. But I did a lot of other things, too,” Weiner says wistfully at the beginning of the movie. But toward the end, after that rude gesture toward the press, he acknowledges that “I have this virtually unlimited ability to [f—] up things, day by day.”

“Weiner” is a clear-eyed look at how Anthony Weiner built a hell of his own making and how the press contributed to its construction. But the movie never loses sight of the fact that other people live in that hell, too, and that day by day, Weiner’s actions take a terrible toll on their lives.