What's the difference between immunodeficiency and autoimmunity?

Function and target. The immune system should react against substances that harm us, and should tolerate substances that do not harm us. In immunodeficiency, there is a weakness on the immune response. Infectious occur frequently and more severe. In autoimmunity, there is malfunction on the immune response, targetting our own tissues, such as our joints in rheumatoid arthritis. Both processes may occur together.