Ben Affleck just completed a stint in rehab for alcohol abuse — and is thanking his estranged wife Jennifer Garner for her support.

The 44-year-old actor checked himself into a program immediately following the Oscars two weeks ago for a drinking problem that has been going on "a long time," according to TMZ.

MORE: Samuel Affleck Looks All Grown Up in Latest Photos With Mom Jennifer Garner

However, in a short message on his Facebook page, the father-of-three opened up about his struggle with addiction and revealed he is on the road to recovery.

"I have completed treatment for alcohol addiction; something I've dealt with in the past and will continue to confront," he wrote. "I want to live life to the fullest and be the best father I can be. I want my kids to know there is no shame in getting help when you need it, and to be a source of strength for anyone out there who needs help but is afraid to take the first step."

ben affleck kids splash

Ben and Jen with kids, Violet, 11, Seraphina, 8, and Samuel, 5.

He also took the time to thank Jennifer, 44, who announced their separation in 2015 after 10 years of marriage.

"I'm lucky to have the love of my family and friends, including my co-parent, Jen, who has supported me and cared for our kids as I've done the work I set out to do," he added. "This was the first of many steps being taken towards a positive recovery."

MORE: Ben Affleck and Matt Damon Are Cousins? Plus More Celebrities You Didn't Know Are Related!

This is not the first time Ben has gone to rehab. In 2001, he checked into the Malibu treatment facility Promises.

The Gone Girl actor has also been very vocal about his family's struggle with alcoholism.

"[My father] was an alcoholic… I did know that as a child. He drank a lot. My father was a — what did they call him — a real alcoholic," he told Barbara Walters in 2012. "He, you know, drank all day, drank every day, and to his credit, he got sober ultimately. He's been sober for several decades, which I think is pretty impressive."