The cause of death for rapper Mac Miller has been confirmed as an accidental overdose.

Rolling Stone reported that, according to a toxicology report released by the L.A. County Coroners Office, a combination of fentanyl, cocaine and alcohol caused his death.

>> Read more trending news

Fentanyl, an opioid, has caused the death of Prince, Tom Petty and Lil Peep.

Miller died Sept. 7 in his Los Angeles home. He was 26 years old.

"He was a bright light in this world for his family, friends, and fans," Miller's family said in a statement at the time of his death.

Related: Rapper Mac Miller dead at 26 

Miller had been candid about his struggle with drug abuse in interviews and his music. Before his death, he spoke about an accident in which he was arrested on DUI charges in May.

“I made a stupid mistake,” Miller told Beats 1 radio host Zane Lowe July 23. “I’m a human being. Like, (I) drove home drunk. But it was the best thing that could have happened. … I needed that. I needed to run into that light pole and literally, like, have the whole thing stop.”

Rapper Mac Miller died of an accidental overdose of fentanyl, cocaine and alcohol, the L.A. County Coroners Office said.

Credit: Rich Fury

icon to expand image

Credit: Rich Fury

Miller, whose last album, "Swimming," was released in August, spoke to Vulture in a profile published Sept. 7 about being honest about what he was dealing with in his music.

“That’s the goal, to get better and to try to make this (expletive) the most of a reflection of who I am,” he said. “I used to rap super openly about really dark (expletive) because that’s what I was experiencing at the time. That’s fine, that’s good, that’s life. It should be all the emotions.”