Rock superstar Tom Petty died of an accidental drug overdose as a result of taking various medications that included opioids, the Los Angeles county coroner and his family said Friday.

The beloved musician’s system showed traces of fentanyl, oxycodone, temazepam, alprazolam, citalopram, acetylfentanyl and despropionyl fentanyl, according to a statement from Jonathan Lucas, the chief medical examiner for the coroner’s office.

In a message posted on Facebook, Petty’s wife and daughter confirmed he was taking a mix of drugs to treat health issues.

“Unfortunately Tom’s body suffered from many serious ailments including emphysema, knee problems and most significantly a fractured hip,” his wife, Dana, and daughter, Adria Petty, said.

Tom Petty performs on June 22, 2012 in Newport, Isle of Wight. Samir Hussein / Getty Images file

“On the day he died he was informed his hip had graduated to a full on break and it is our feeling that the pain was simply unbearable and was the cause for his over use of medication,” they said.

Related: Tom Petty, rock craftsman admired for four decades, dies at 66

The coroner’s office specified the official cause of his death as multi-system organ failure due to resuscitated cardiopulmonary arrest due to mild drug toxicity.

“We knew before the reported was shared with us that he was prescribed pain medications for a multitude of issues including Fentanyl patches and we feel confident that this was, as the coroner found, an unfortunate accident,” his family said.

Petty went into cardiac arrest at his home in Malibu on Oct. 2, 2017. He was rushed to UCLA Medical Center, but he could not be revived, his representatives said at the time. He was declared dead that night, at the age of 66.

Morning Joe remembers rock legend Tom Petty 2:14

The legendary singer and songwriter was a Rock ‘n’ Roll Hall of Famer who wedded 1960s-era folk rock with the Southern accents of his native Florida.

He performed in a string of groups before he joined other rockers to form the Heartbreakers. The band soared to fame with the single “Breakdown,” followed shortly by their first album, “Tom Petty and the Heartbreakers,” in 1976. That record was hugely popular, earning the band legions of fans.

“We continue to mourn with you and marvel at Tom Petty and the Heartbreakers’ incredible positive impact on music and the world,” his family said on Facebook. “And we thank you all for your love and support over the last months.”