Saumitra Jha presents a fantastic model of peaceful inter-ethnic cooperation:
Ethnic group members can produce goods and service that complement, rather than compete with each other;
Inter-ethnic complementarity would be costly to seize or copy;
The more vulnerable ethnic group has good outside options, so could credibly threaten to stop production or leave.
Competition increases the likelihood of conflict. The stronger ethnic group would try to reduce competition by attacking the weak, seizing their profits and/or suppressing production. Fixed goods (like land, wealth or machines) are especially vulnerable to seizure, so raise risks of conflict.
To demonstrate the plausibility of this model, he presents evidence from South Asia. I suggest it has far wider parallels - in both Sub-Saharan Africa and the European Union. As young Europeans struggle to secure decent jobs and affordable housing, many are voting for right-wing politicians, who repeatedly vilify migrants as competition. If outsiders are not seen as complementary, this can escalate into hostility and conflict.