In a new interview with Rolling Stone, Timbaland details a drug addiction that nearly cost him his life, revealing that he “was on drugs” until three years ago.

“I was on [opioid pain medication] OxyContin,” said the producer.

Timbaland said he first started taking pain medication in his 30s after lingering nerve damage from a gunshot wound that he got during his teens. The producer eventually began to abuse the drug, falling into what Rolling Stone called a “cycle of depression and addiction” as his career struggled and his marriage ended.

Rolling Stone added:

He eventually did suffer what he believes to be a near-death overdose while sleeping three years ago. “All I can tell you is that there was a light,” he says. “I woke up trying to catch my breath, like I was underwater. But through that whole thing I saw life – I saw where I would be if I don’t change, and where I could be if I did.”

Timbaland’s girlfriend Michelle revealed she wouldn’t sleep out of fear that he’d stop breathing in the night. Then three years ago he suffered what he believes was a near-fatal overdose in his asleep.

“All I can tell you is that there was a light,” the rapper said. “I woke up trying to catch my breath, like I was underwater. But through that whole thing I saw life — I saw where I would be if I don’t change, and where I could be if I did.”

He weaned himself off the pills, and then stopped taking them altogether, which lead to withdrawal. “But I thought about Michael Jackson,” said Timberland. “I didn’t want to be old and taking these pills.”

The producer was recently spotted in the studio with $ki Mask the Slump God, previewed new music with Young Thug and just finished working on Justin Timberlake’s new album. He also has a solo LP in the works.

“Right now, I feel like what I can do with my legacy is to give back,” he said. “Which means finding the youth of today. Quincy Jones – he was 50 when he did Thriller. What’s my Thriller?”