You have some good responses so far. Mental illness can be caused by the imperfect nature of our mortal state, a biological fluke, or by substance abuse (not your case I'm sure), or by living environment such as abusive upbringing and mental compensation as a defense mechanism. Those have all been addressed by other respondents. They can be treated with medication, counseling, love and blessings.
The last item is the possession of evil spirits. My maternal grandmother suffered a mental/nervous breakdown when my Mother was only three. She spent the last 15-20 years of her life in the Camarillo State Mental Hospital where she finally passed away at the young age of 61 from lung cancer of all things (she never smoked a day of her life). My mother asked her Stake leaders what they thought of the situation and they told her the evil spirit story. Just as she was nearing death, her mind cleared and she recognized my grandfather and mother which she had not done for the whole time she was in the hospital. The story was that the evil spirit, knowing that its host was dying, left and that her natural abilities could again come forth. I don't know if I believe that story or not but you can think about it for what it is worth. My grandparent were not LDS. My mother is a convert and the only member in her otherwise Protestant family. They are all good people and faithful Christians as far as they understand it. The point is that grandmother never received a priesthood blessing that could have released her from possession, if indeed that was the cause of her illness.
In my own family, my wife suffered from what she described as dark influences after we got married. She had been inactive and reactivated when I met her. We were married in the L.A. temple and the influences from her inactive days were trying to reclaim her. I gave her a blessing and those influences left her and she has never been bothered by them again, more than 33 years later.
So, your question does not have a simple answer. There are many factors with many potential solutions. Please know that we are aware of mental illness and treat it with love, concern and respect. There will be no need to fear rejection. I hope this helps a little bit.