This paper examines the legality and limits of security detention in armed conflict situations. It particularly investigates the issues of whether the protection of national security is a legitimate ground to restrict the right to liberty of persons in situations of international or non-international armed conflict, and if so, what are the limits to a State's prerogative to restrict the right to liberty of individuals suspected of threatening its national security. On the basis of a thorough analysis of the relevant extant rules of international law regulating warfare, the paper concludes that security detention is permissible in armed conflict situations regardless of whether the nature of the conflict is international or non-international. However, the prerogative of a State to impose security detention is circumscribed by a plethora of fundamental substantive and procedural safeguards against arbitrariness that are provided in the different rules of international humanitarian law and international human rights law. These safeguards affirm that the search for absolute security is neither desirable nor attainable and that the mere invocation of security concerns does not grant an absolute power to restrict or suspend the liberty of individuals in armed conflict situations. Whenever it is imposed, security detention should be preventive in nature, and must aim at safeguarding the basic national security interests of a State from serious, future, direct and imminent threats related to the armed conflict situation. Detainees should also be able to challenge its legality before a competent organ at the initial or later stage of the detention through a system of periodic review.