Tests show music superstar Prince, who was found dead in his home in a Minneapolis suburb in late April, died of an accidental, self-administered overdose of an opioid painkiller, the Midwest Medical Examiner's Office said on Thursday.

The medical examiner, based in Anoka County, Minnesota, had been investigating the 57-year-old singer's death since he was found in an elevator in his home and studio outside Minneapolis on April 21.

RELATED: Remembering the life of legendary pop icon Prince

"The decedent self-administered fentanyl," the report said, listing cause of death as "fentanyl toxicity" and noting it was accidental.

Fentanyl is a highly addictive opiate that is more powerful than morphine and is used to treat patients with severe pain, often after surgeries.