We constructed a theoretical model of cost-benefit optimization for farmers who face continued economic loss due to crop raiding by wild herbivores, as well as for the wild herbivores that do so. Insights obtained from the model include: (i) In sustenance agriculture, a farmer needs to optimize net benefit rather than benefit-to-cost ratio, whereas herbivores need to optimize the benefit-to-cost ratio. (ii) It is imperative for a farmer to disinvest from agricultural inputs when threatened by depredation. (iii) Many mitigation measures that are highly successful on an experimental scale are most likely to fail when used on a mass scale. (iv) The effectiveness of mitigation measures such as fencing, trenching and culling will be nonmonotonic, being counterproductive under certain conditions.