Multiple sclerosis is thought to be an autoimmune disease.
The healthy immune system recognises your own body cells using the HLA system. When immune cells come across cells without the HLA flag, they set off a cascade of reactions that attack and destroy the invading cells. These might be from a virus or bacterial infection.
In some conditions, for reasons that aren't fully known, this protective mechanism fails to work. The immune system doesn't recognise the HLA flag on your own cells and attacks them as if they were viruses or bacteria. These conditions are called autoimmune diseases.
Autoimmune conditions include rheumatoid arthritis, where the lining of the joints become inflamed, and Crohn's disease, which affects the walls of the intestines. In MS the autoimmune response leads to attacks on myelin, which covers the nerves within the central nervous system.