The arms race between bacteria and phages led to the development of sophisticated anti-phage defense systems. A flurry of recent discoveries showed that the microbial pan-genome contains over 200 defense systems whose function was so far unexplored. Our studies surprisingly reveal that bacterial defense systems are ancient versions of central components in the immune system of plants and animals. The talk will present progress in understanding the mechanisms of action of the bacterial immune system, and will highlight cases in which bacterial defense from phage gave rise to key components in the plant and animal innate immune systems.