A loophole is an ambiguity or inadequacy in a system, such as a law or security, which can be used to circumvent or otherwise avoid the purpose, implied or explicitly stated, of the system. Loopholes are searched for and used strategically in a variety of circumstances, including taxes, elections, politics, the criminal justice system, or in breaches of security, or a response to one's civil liberties.
Loopholes are distinct from lacunae, although the two terms are often used interchangeably. In a loophole, a law addressing a certain issue exists, but the law can be legally circumvented due to a technical defect in the said law. A lacuna, on the other hand, is a situation whereby no law exists in the first place to address that particular issue.
Historically, arrow slits were narrow vertical windows from which castle defenders launched arrows from a sheltered position, and were also referred to as "loopholes".
Thus a loophole in a law often contravenes the intent of the law without technically breaking it, much as the small slit window in a castle wall is a small opening in a seemingly impenetrable defensive measure that lets the defender gain the advantage of being able to fire without easily being fired back upon.