This study is a randomized controlled trial studying the efficacy of an iCBT treatment for patients with chronic pain and comorbid psychiatric distress. Half the participants will receive treatment at first, while the other half serve as a control group. After the first group has received treatment, the same program will be offered to participants in the control group. Treatment will be tailored on the level of individual participants, enabling individuals suffering a wide range of problems to be recruited. The treatment will consist of a 10-week guided self-help program, followed by a booster program and follow-up one year later. During the curse of the treatment the participants will be guided via text communication by a licensed psychologist or a candidate psychologist on their last year of studies.