To study the effectiveness of attachment-based compassion therapy (ABCT) for reducing affective distress in a sample of outpatients with depressive, anxiety, or adjustment disorders, and to explore its mechanisms of action. This randomized controlled trial involved the assessment time points of pretreatment, posttreatment and 6-month follow-up. A total of 90 patients from three mental health units in Castellón, Spain, were recruited and randomly assigned to "ABCT + treatment as usual (TAU)," "Mindfulness-based stress reduction (MBSR) + TAU" or "TAU" alone. Affective distress, as measured by the "Depression, Anxiety and Stress Scales" (DASS-21) was the main outcome; self-compassion and mindfulness were also assessed. Multilevel mixed-effects models were used to estimate the effectiveness of the program, and path analyses were conducted to study the potential mechanistic role of mindfulness and self-compassion. ABCT was not superior to MBSR in any outcome or at any assessment point. ABCT was superior to TAU alone both posttreatment (B = -13.20; 95% confidence interval [CI]: -19.57, -6.84) and at 6-month follow-up (B = -7.20; 95% CI: -13.63, -0.76) for reducing DASS-21, and MBSR was superior to TAU alone both posttreatment (B = -11.51; 95% CI: -17.97, -5.05) and at 6-month follow-up (B = -8.59; 95% CI: -15.09, -2.10), with large effects (d ≥ 0.90). Changes produced by ABCT in DASS-21 were mediated by self-compassion, whereas changes produced by MBSR were mediated by both mindfulness and self-compassion. ABCT is effective for reducing affective distress in patients with anxiety, depressive and adjustment disorders, although its effect is not superior to that offered by MBSR. Self-compassion seems to be a significant mediator of the effects of ABCT.