LOS ANGELES (Reuters) - Oscar winner Ben Affleck said on Thursday he had completed a 40-day residential alcohol rehab program but said that battling addiction “is a lifelong and difficult struggle.”

Affleck, 46, who also went to rehab in 2017 and 2001, said in a posting on his Instagram account that he remained in outpatient care, and thanked his family, friends and fans for their support.

“Battling any addiction is a lifelong and difficult struggle. Because of that one is never really in or out of treatment. It is a full time commitment. I am fighting for myself and my family,” he wrote.

Affleck has three children with actress Jennifer Garner. The couple separated in 2015 but in August Garner was pictured in Los Angeles driving Affleck to a treatment center.

Affleck shot to fame in 1998 when he shared a screenplay Oscar for drama “Goodwill Hunting” with his best friend Matt Damon. In 2013, he took home a second Oscar for best picture winner “Argo,” which he produced and directed.

The “Batman” and “Gone Girl” star has often spoken of his struggles with alcohol, which also afflicted his father and his brother, actor Casey Affleck.

Casey Affleck told television show “Entertainment Tonight” last month that he and Ben come from a long line of alcoholics.

“Ben is an addict and an alcoholic. Most of my grandparents are alcoholics. My father is an alcoholic, as bad as you can be, and he’s been sober for about 30 years. I’ve been sober for about six years,” he said.