Education in prison helps to reduce recidivism, but the relationship between academic performance and recidivism is spurious, as most prisoners belong to more vulnerable and deprived social groups with deficits that not only influence lower academic standards but also have a direct impact on fewer opportunities once released. The objective of this study is to analyze the relationship of cognitive-motivational variables such as academic self- concept, academic self-efficacy, learning orientation and school climate, with the academic achievement of inmates, as well as with other measures of their academic performance, such as satisfaction with the subject, perceived learning and expected grade. To this end, a group of students in Section I and II of the Education for Adults who were studying in prison was compared with another group of students of the same level who were attending adult education centers in the community. The total sample consisted of 233 participants between the ages of 18 and 64, of whom 124 were in prison. Participants answered a questionnaire including 11 scales that had previously obtained the necessary evidence of reliability and validity. The analysis of the data indicated that the academic performance and academic achievement of students in prison were better than those of students outside prison, that the cognitive-motivational variables were related in both groups only to academic performance and not to academic achievement and that this relationship varied within each group. The results are discussed focusing on the fact that imprisonment makes the teaching/learning process harder, but that the difficulties should be solved taking into account, not so much that students are people who have committed a crime for which they are serving a sentence, but that they are adults who have not completed compulsory education and are motivated to do so.