"To keep at bay" is an idiomatic English expression meaning to keep at a safe distance. It usually has the sense of a quarry trapped but managing to fend its pursuers off despite being cornered. It is one of a number of related expressions deriving from the practice of hunting with hounds.
"Keep at bay" derives from the medieval French word "abaier," "to bark." The word entered Middle English in the 13th century, and is the root of the verb "to bay," which describes the noise a hound makes. Hounds were widely used in hunting in the medieval period, used to hunt quarry such as deer and boar. Their task was to track and pursue the animal, while hunters followed. When the hounds eventually cornered their quarry, they would bark or "bay" loudly, allowing the hunters to catch up with them. They were then said to be "at bay."
A number of expressions relate to this concept, each with a related but slightly different meaning. Hounds cornering an animal are said to "bring it to bay." Similarly, when it realizes it has nowhere to flee to, the animal is "at bay." The final act of the chase may be for the quarry to "turn at bay," menacing its pursuers in order to hold them at a safe distance. This act is the root of the expression "to keep at bay." A stag or boar can be a dangerous opponent; hounds pursuing one would usually not engage it, choosing instead to wait for hunters to arrive.
"At bay," therefore, has a number of slightly different but related meanings. It can describe the position of the pursuer as well as the position of the quarry. "Keep at bay" derives from the last of these, the image of a cornered animal holding off its pursuers. In modern English, the expression can denote any kind of pursuer; one can speak of "keeping the bill collectors at bay," for instance. It need not even refer to a real pursuer; a person could be said to be "keeping disaster at bay."
"Keep at bay" has a similar sense to the expression "keep at arm's length," but the two terms have slightly different uses. To keep someone or something at arm's length suggests caution and suspicion, while keeping an opponent at bay suggests an individual who is surrounded and in danger of being overwhelmed. Other related expressions include "fend off," which comes from boating jargon, or "ward off."