One proposed mechanism of language change concerns the role played bysecond-language (L2) learners in situations of language contact. Ifsufficiently many L2 speakers are present in a speech community in relation tothe number of first-language (L1) speakers, then those features which present adifficulty in L2 acquisition may be prone to disappearing from the language.This paper proposes a mathematical model of such contact situations based onreinforcement learning and nonlinear dynamics. The equilibria of adeterministic reduction of a full stochastic model, describing a mixedpopulation of L1 and L2 speakers, are fully characterized. Whether or not thelanguage changes in response to the introduction of L2 learners turns out todepend on three factors: the overall proportion of L2 learners in thepopulation, the relative advantages of the linguistic variants in question, andthe strength of the difficulty speakers face in acquiring the language as anL2. These factors are related by a mathematical formula describing a phasetransition from retention of the L2-difficult feature to its loss from bothspeaker populations. This supplies predictions that can be tested againstempirical data. Here, the model is evaluated with the help of two case studies,morphological levelling in Afrikaans and the erosion of null subjects inAfro-Peruvian Spanish; the model is found to be broadly in agreement with thehistorical development in both cases.