The implementation of the United States military surge in Iraq coincided with a significant reduction in ethnic violence. Two explanations have been proposed for this result: The first is that the troop surge worked by increasing counterinsurgent capacity, whereas the second argument is that ethnic unmixing and the establishment of relatively homogenous enclaves were responsible for declining violence in Baghdad through reducing contact. We address this question using an agent-based model that is built on GIS-coded data on violence and ethnic composition in Baghdad. While we cannot fully resolve the debate about the effectiveness of the surge, our model shows that patterns of violence and segregation in Baghdad are consistent with a simple mechanism of ethnically motivated attacks and subsequent migration. Our modeling exercise also informs current debates about the effectiveness of counterinsurgency operations. We implement a simple policing mechanism in our model and show that even small levels of policing can dramatically mitigate subsequent levels of violence. However, our results also show that the timing of these efforts is crucial; early responses to ethnic violence are highly effective, but quickly lose impact as their implementation is delayed.