Bacteria have developed numerous ways to resist infection by bacteriophages, also known as phages. While the mechanisms of many of these anti-phage systems have been elucidated in recent years, the regulation of these systems is still relatively understudied. Here, we identify a transcriptional regulator of anti-phage immune systems that we term CapW. CapW and its homolog BrxR are associated with a variety of anti-phage systems in bacteria. We show that CapW binds a specific palindromic DNA sequence in the promoter of its associated anti-phage system, operating as a transcriptional repressor to keep expression of the system low. Combining x-ray crystallography and in vitro biochemical studies, we determined the structure of CapW and showed that it binds double stranded DNA (dsDNA) at its N-terminal wHTH domain and binds single stranded DNA (ssDNA) through its C-terminal WYL and WCX domains. Fluorescence polarization assays indicate that CapW can only bind dsDNA in the absence of ssDNA, showing that ssDNA is likely the ligand and signal for CapW. As ssDNA is the ligand for CapW, CapW can respond to a variety of signals in bacteria. CapW responds directly to phage infection but is not required for the anti-phage system to be protective. CapW also responds to DNA damage and the activation of lysogenized phage. Since prophages are often activated by cellular stresses, like DNA damage, we hypothesize that the role of CapW is to enable anti-phage systems to prevent the escape of prophage by responding to the same signal that activates the prophage.