A loophole is an ambiguity in a system, such as a law or security, which can be used to circumvent or otherwise avoid the intent, 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.
Historically, arrowslits 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 provides the only ready means of gaining entry without breaching or destroying the wall or a gate. For example, in some places, one may avoid paying taxes to the jurisdiction by forming a second residence in another location, or a commercial property can be built in a residential zone if it is made also for residential use.
In a security system, the one who breaches the system (such as an inmate escaping from prison) exploits the loophole during breach. Such weaknesses are often studied in advance by the violator, who spends time observing and learning the routine of the system and sometimes conducts surreptitious tests until such a loophole can be found.
Examples of legal loopholes: