Commensal gut bacteria impact the host immune system and can influence disease processes in several organs, including the brain. However, it remains unclear whether the microbiota has an impact on the outcome of acute brain injury. Here we show that antibiotic-induced alterations in the intestinal flora reduce ischemic brain injury in mice, an effect transmissible by fecal transplants. Intestinal dysbiosis alters immune homeostasis in the small intestine, leading to an increase in regulatory T cells and a reduction in interleukin (IL)-17-positive γδ T cells through altered dendritic cell activity. Dysbiosis suppresses trafficking of effector T cells from the gut to the leptomeninges after stroke. Additionally, IL-10 and IL-17 are required for the neuroprotection afforded by intestinal dysbiosis. The findings reveal a previously unrecognized gut-brain axis and an impact of the intestinal flora and meningeal IL-17(+) γδ T cells on ischemic injury.