The problem of the relationship between law, legality and social justice is one of the fundamental problems of legal theory and law enforcement practice.The purpose of the study is to assess the problem field in the relationship between the principles of legality and social justice in domestic law enforcement practice and to substantiate the key role of the principle of social justice in its further development. The authors proceed from the position that the theoretical and practical experience of posing and interpreting this problem, accumulated in the history of world and Russian legal science, is an epistemological and worldview resource that has not only theoretical, but also quite practical significance.Methodology. Analytical methods were used to study the relationship between legality and social justice, historical-retrospective and hermeneutical methods in revealing the semantic meaning of these concepts, as well as a dialectical method in interpreting existing contradictions in their law enforcement practice.Results. The article, taking into account the current two main trends - on the one hand, towards “de-ideologization” and, on the other hand, towards “re-ideologization” of legal science - examines the relationship and interpretation of such concepts as “legality”, “law”, "legal proceedings", "social justice" in modern scientific (legal) discourse and in law enforcement practice. The development of the semantic content of the principle of social justice is shown through the concepts of “justice” (Aristotle), “moral perfection” (B.A. Kistyakovsky), “decent human existence” (P.I. Novgorodtsev), “proportionality” (A.F. Koni) etc. Based on a comparison of different theoretical and methodological approaches to defining these concepts, their content and role in law enforcement practice are revealed. A provision has been formulated on the need to expand openness and public principles in improving legal proceedings, since the encountered practice of closed legal proceedings does not correspond to the principles of openness and publicity. The problematic issues of the comprehend theory of law associated with the blurring of the concepts of “legality” and “social justice” in the context of existing ideological pluralism are revealed. In connection with the anniversary – the 180th anniversary of the birth of the outstanding Russian lawyer A.F. Koni, his contribution to the development of ideas about legal morality and judicial ethics is shown. In particular, his idea about the “spirit of legality”, that the “truth of life” should be higher than the “legal truth”.Conclusion. Taking into account the influence that ideology has on the law, a position has been formulated on the need to form a unified ideological view in determining socially fair legal content and its clear legislative codification. The main trends in the development of modern scientific ideas about the relationship between ideology and law have been identified. The thesis about the key importance of social justice in the development of law and legality is substantiated.