Contrary to popular perception, empirical evidence suggests that immigrants do not necessarily commit more crimes than natives, in spite of having lower legitimate earning opportunities. To make sense of this, we propose a novel theoretical framework based on a predator/prey model of crime, where endogenous migration decisions and career choices (between licit and illicit activities) are jointly determined. In this setting, we show that the involvement of migrants in crime crucially depends on self-selection into migration, as well as on productivity and institutional quality in the host economy. In particular, immigrants may display a lower crime rate than natives even if they are less productive on the honest labor market - and this result can still hold if career choices are revised after migration. We also find that stricter immigration policies could induce an adverse selection of migrants, and eventually attract more foreign-born criminals. Finally, a dynamic extension of our model can account for the higher crime rates of second-generation immigrants, and highlights the critical role of immigration and assimilation for the long-run evolution of crime and institutions in host countries.