The actor went to rehab shortly before the film, which follows a former basketball all-star struggling with addiction, was due to begin shooting.
“So, what happened was, just as we started prepping the movie, Ben fell off the wagon,” Gavin O’Connor told student publication 34th Street Magazine.
“So he ended up going to rehab, and I didn’t know if the movie was over. The studio certainly thought the movie was over.”
He added: “His ex-wife Jennifer Garner called me up, and told me that when he went to rehab, he took a basketball with him. She said, ‘Gavin, he’s asking you, please don’t pull the plug on the movie, he really wants to do this.'”
O’Connor explained Affleck “had about a week of detoxing” before he met with the actor to discuss the future of the film.
“We spent half a day together and figured out a way to do this that will work for him, because most importantly he needed to recover and needed to get his sobriety on track,” he said.
“That overtook everything. And then he got out the day before we started shooting. So we had a very raw, vulnerable guy showing up for our first day of shooting.”
The Way Back will arrive in UK cinemas on 24 April.
Join our new commenting forum
Join thought-provoking conversations, follow other Independent readers and see their replies