I provide evidence that the degree to which medieval Hindus and Muslims could provide complementary, nonreplicable services and a mechanism to share the gains from exchange has resulted in a sustained legacy of ethnic tolerance in South Asian towns. Due to Muslim-specific advantages in Indian Ocean shipping, interethnic complementarities were strongest in medieval trading ports, leading to the development of institutional mechanisms that further supported interethnic exchange. Using novel town-level data spanning South Asia's medieval and colonial history, I find that medieval ports, despite being more ethnically mixed, were five times less prone to Hindu-Muslim riots between 1850 and 1950, two centuries after Europeans disrupted Muslim overseas trade dominance, and remained half as prone between 1950 and 1995. Household-level evidence suggests that these differences reflect local institutions that emerged to support interethnic medieval trade, continue to influence modern occupational choices and organizations, and substitute for State political incentives in supporting interethnic trust.