The article examines the legality of applying a preventive measure in the form of detention in Ukraine in the context of the ECHR case law. The purpose of the study is to analyze the compliance of the criminal procedure legislation of Ukraine and domestic case law with the requirements of Article 5 of the Convention for the Protection of Human Rights and Fundamental Freedoms, taking into account the conditions of martial law. The methodological framework includes formal-legal, comparative-legal, doctrinal and forecasting methods. As a result, the study revealed systemic violations of the principles of proportionality, effective judicial control, and risk assessment in the selection of a preventive measure. The analysis of ECHR cases demonstrates the ineffectiveness of appellate review, the formalistic nature of judicial decisions, the neglect of the health of suspects, and procedural abuse. The article proposes comprehensive reforms of legislation, judicial practice, and the system of free legal aid drawing on the experience of Council of Europe member states. The research concludes that it is necessary to move from declarative to substantive control over the observance of human rights in the field of preventive detention.