MJ evidently suffered from at least two mental disorders.
He suffered from anorexia nervosa, an eating disorder which falls into the category of mental disorders.
He used to intentionally restrict food for a number of reasons, while many times he used to take food intravenously.
This mental disorder emanated mainly from his problematic relationship with his father when he was a child.
It was also a result from the way he wanted his body to be (he wanted an agile & thin body in order to become even better as a dancer).
Also, he evidently suffered from depression, which is another case of a mental disorder.
He used to take anti-depressants & he increased the dosages while he was becoming older.
The allegations he faced (1993, 2004) played a crucial role in increasing the dosages that he was taking.
Toxicology reports have conclusively showed also that even in his final months he was still taking a significant amount of anti-depressants due to an additional factor which was his increased anxiety for his upcoming 'This Is It' comeback in 2009.