BMX legend Dave Mirra suffered from depression and heavy drug abuse before he died ... his family told law enforcement.
TMZ Sports has obtained the medical examiner's report -- confirming the 41-year-old shot himself in the head on Feb. 4th with a .38 Smith & Wesson revolver.
Witnesses told police Mirra had been hanging out at his friend's house that day when he walked out and went to his truck. His friends went to search for him and found him dead in his truck in the driveway, with the gun in his right hand.
"Per family, he had been recently suffering from depression and heavy drug abuse."
According to the toxicology report, Mirra did NOT have traces of drugs in his system at the time of his death -- however, he did have a small amount of alcohol in his bloodstream.
Mirra is survived by his wife and two young daughters.
After his death, Mirra was diagnosed with CTE -- a brain condition believed to be caused by repeated head trauma.
The medical report included a diagram of Mirra's body showing he was covered in scars due to injuries suffered over the years.
The M.E. noted 5 previous scars on Mirra's head alone -- including 4 to the back of his head.