The article highlights the urgent problem of countering religious extremism in the institutions of the penitentiary system of the Republic of Kazakhstan. The authors consider the legal aspects of regulating the theological rehabilitation of those convicted of extremist and terrorist crimes. Based on the conducted research, the authors conclude that it is necessary to ensure a systematic approach to the theological rehabilitation of convicts and the involvement of civil society organizations in this process. The purpose of the study is to identify effective measures for the rehabilitation of those convicted of crimes of extremist and terrorist orientation. When writing a scientific article, various research methods were used, which as a result made it possible to comprehensively reveal the problem under study. For a more complete study, the analysis of statistical and empirical materials containing information related to extremist and terrorist crime was carried out. As a result of the conducted research, the authors conclude about the effectiveness of the measures taken by law enforcement agencies, in particular by employees working in correctional institutions, whose activities are aimed at the process of adaptation of those convicted of crimes related to extremist and terrorist activities in correctional institutions. The conclusion of the study provides a number of effective measures aimed at improving theological rehabilitation work with persons in the process of re-socialization in a correctional institution.