Where does the word “Loophole” come from and What does Loophole mean?

The kind of loop now attached to this hole is seldom used or heard of any more.

In the late Middle Ages, however, a loop was a narrow window, in a castle or other fortification, through which an archer could direct his missiles, but so narrow as to be a baffling target for an opposing bowman.

The masonry of the window widened inwardly to permit a wider range for the defending archer.

Possibly to avoid confusion between loop, “window,” and loop, “a fold,” the first became identified as loophole.