Ben Affleck has been opening up about his alcoholism and difficult path to sobriety while promoting his upcoming film, "The Way Back," in which he plays an alcoholic.

Taking on a role that mirrored some of the actor's own personal demons helped to "free" him, Affleck revealed in a recent interview with The Associated Press. But there is one scene where his character, Jack Cunningham, makes amends to his wife that caused the 47-year-old to suffer a breakdown on set.

“It was probably the second take, Ben just had a breakdown. I’m getting chills thinking about it. It was like the dam broke and everything came out,” the film's director, Gavin O'Connor, told the AP.

BEN AFFLECK'S INTERVIEWS ABOUT JENNIFER GARNER HAVE LEFT HER BOYFRIEND JOHN MILLER 'UNCOMFORTABLE': REPORT

The director furthered: “I just remember the crew, everyone was frozen, watching him bear his soul. It was obviously real. A lot of things that he probably had to say in his own life, or maybe he had said, I don’t know.”

Affleck's emotions were so raw that some parts of the scene were cut from the final version of the film.

"It would be too hard for an audience to watch, too personal," O'Connor explained.

The "Argo" director spoke with AP about other parallels the film has to his life.

BEN AFFLECK SAYS EX JENNIFER LOPEZ SHOULD HAVE RECEIVED AN OSCAR NOMINATION FOR 'HUSTLERS'

“Unfortunately, I had actually lived that life and done the research. I brought a certain perverse expertise because I knew what it was like to feel in thrall to a compulsion that wasn’t good for me," Affleck says. “I knew how hopeless that can feel. And I knew how enormously frustrating it is. But I also knew something really important, which is: People get better. You can get better.”

Affleck went into rehab at the start of prepping for the movie, O'Connor revealed, marking somewhat of a difficult transition for Jennifer Garner's ex-husband.

"So now we were prepping the movie while he was in rehab and we thought it was going to fall apart,” said O’Connor. “But he still wanted to do it. When he got out, he was incredibly raw and vulnerable and I think a little lost just in regard to having to confront the demons.”

BEN AFFLECK SHARES WHAT HE'S LOOKING FOR IN HIS NEXT RELATIONSHIP: 'ALL THE SORT OF USUAL STUFF'

Despite his admitted relapses — last October, he was captured drunk on camera — Affleck told AP his journey to sobriety has been humbling.

“It takes time to learn all the things you need to learn. And it also takes time to suffer enough until at some point there’s something inside you that says, ‘No mas. I give,’” says Affleck. “What it really is, personally in me and what I’ve seen in others that I want for myself, is a profound sense of humility. You are not stronger than the thing you’re addicted to. It is stronger than you. It will always be stronger than you."

BEN AFFLECK THANKS EX-WIFE JENNIFER GARNER FOR BEING 'THOUGHTFUL, CONSIDERATE, RESPONSIBLE' IN PUBLIC NOTE

Affleck previously opened up to The New York Times in an interview about how his alcoholism took a toll on his 10-year marriage to Garner.

The exes, who have three children together, separated in 2015 and divorced in 2018.

“The biggest regret of my life is this divorce,” Affleck told the New York Times, explaining that while he still feels guilt over the split, he's moved beyond the shame. “Shame is really toxic. There is no positive byproduct of shame. It’s just stewing in a toxic, hideous feeling of low self-worth and self-loathing.”

CLICK HERE TO GET THE FOX NEWS APP

Affleck then admitted he "drank relatively normally" for most of his marriage, but in 2015 or 2016, he began to drink more heavily, which "created more marital problems."

"The Way Back" comes out March 6.

The Associated Press contributed to this report.