Ben Affleck wrote a note thanking his ex-wife Jennifer Garner following their divorce.

The Oscar-winning actor/director sat down with Diane Sawyer for a candid interview on Good Morning America, in which he opened up about his battle with depression and sobriety, as well as spoke openly about his children.

"I never thought that I was gonna get divorced. I didn’t want to get divorced. I didn’t want to be a divorced person. I really didn’t want to be a split family with my children. And it upset me because it meant I wasn’t who I thought I was. And that was so painful and so disappointing in myself," Affleck said during the tell-all interview.

"Divorce is very painful and alcoholism is very painful. They just are. If there’s something that your child is suffering, that’s a level of pain that is not easily gotten past, not easily forgiven, not easily forgotten. And it’s hard," he continued. "You’re not going to avoid causing your kids pain, all pain. Pain is part of life. I take some comfort in that."

"I’m doing my very, very best and I hope that that is— it has to be good enough. I have to, I don’t really have a choice. I have to be the man I want to be at this point, I don’t have any more room for failure of that kind," he added.

Affleck also addressed his recent relapse and rehab stint before acknowledging how it must make his children — daughters Violet and Seraphina and son Samuel — feel to see their father intoxicated.

"I really don’t want my children to pay for my sins," he explained. "Or to be afraid for me, which is one of the hard parts of being the child of an alcoholic. You think, 'What if my dad gets drunk? What if he does something stupid? What if he ends up on TMZ and is on my newsfeed and other kids see it?'"

At the end of the interview, Sawyer read a note that Affleck had written for Garner: "What I want to say publicly and privately is, 'Thank you. Thank you for being thoughtful, considerate, responsible and a great mom and person.'"

In an interview published earlier this week in The New York Times, Affleck also admitted the "biggest regret of my life is this divorce," revealing that his marriage to the actress began to fall apart in "2015 and 2016" when he lost control of his alcoholism. "My drinking, of course, created more marital problems," he said.