Countries rich in gas and oil tend to see disproportionately long conflicts (e.g. Nigeria). Despite the violence, they receive vast inflows of foreign direct investment (FDI) into gas and oil extraction. We argue that the presence of FDI is crucial in explaining conflict duration. Combining sub-national, geo-referenced data on FDI and armed conflict in African countries, we demonstrate that inward FDI in oil and gas prolongs conflict at the national level and leads to a displacement of violence at the local level. Governments are keen on maintaining FDI and hence send their troops to secure resource infrastructure, diverting them from the front. This facilitates the entrenchment of rebel groups. Meanwhile, resource wealth further raises the relative capacity of the state and therefore diminishes incentives to reach a negotiated settlement. To address endogeneity concerns, we compare conflict dynamics between districts that have experienced oil or gas FDI by 2010 to areas that will experience it between 2010 and 2018. To illuminate the mechanisms, we examine the case of Mozambique and demonstrate how FDI altered the government's counter insurgency strategy.