The combination of pain and depression or anxiety is commonly seen in clinical practice. Little is known about the influence of pain on psychopathology over time, as previous studies have been mainly cross-sectional. The objectives of this study are to determine the impact of pain on the course of depressive and/or anxiety disorders, and investigate to what extent the association between pain and course of these mental disorders is mediated by psychiatric characteristics. Data from the Netherlands Study of Depression and Anxiety (NESDA), collected between 2004 and 2009, were used. A total of 1209 participants with a depressive and/or anxiety disorder at baseline were followed up for 2 years. Baseline pain was assessed by location, duration, use of pain medication, and severity (based on Chronic Pain Grade). Course of depressive and anxiety disorders was assessed by Composite International Diagnostic Interview (CIDI) and Life Chart Interview. A higher number of pain locations (OR = 1.10; P =.008), joint pain (OR = 1.64; P <.001), ≥90 days of pain (OR = 1.40; P =.009), daily use of pain medication (OR = 1.57; P =.047), and a higher Chronic Pain Grade score (OR = 1.27; P <.001) were associated with worse course of depressive and anxiety disorders. These associations were largely mediated by baseline severity of the mental disorder. However, joint pain remained associated with a worse course independent of baseline psychiatric characteristics. This study shows that patients with pain are more prone to a chronic course of depressive and anxiety disorders. More attention to pain seems to be necessary when diagnosing and treating these disorders. Future research should focus on treatment modalities for this co-occurrence, with joint pain in particular. © 2011 International Association for the Study of Pain. Published by Elsevier B.V. All rights reserved.