The existence of different sects and religions in the Ayyubid period (d. 567-658 AH) is one of the most important challenges people of that time faced. This issue forced their government to adopt different policies towards them. One of the most important religious groups in the mentioned period was Sofia. Studies about Sufis, who were able to play an effective role in various sections of the society and establish close relations with the government in the Ayyubid period, generally lack attention to the historical context, in which they lived, while no appropriate analysis of the time conditions and the ways of their interactions and relationships with various social institutions, especially with the government, has been presented so far. Using a descriptive-analytical method and citing historical sources, the present study sought to answer the question of what were the political, social, military, and religious positions of Sofia in the controversial arena of the Ayyubid government and how they was able to play a role in the relevant equations. The results of this research indicated that Sofia was able to penetrate into different sections of the society during this period and gain the support of the Ayyubids, while adopting an interactive religion-government approach and making material and economic benefits, such as construction and development of Sofia centers. In return, the Sufis helped to solve some of the political, social, and military problems of the Ayyubids.