When divergence occurs in the presence of gene flow, there can arise an interesting dynamic in which selection against gene flow, at sites associated with population-specific adaptations or genetic incompatibilities, can cause net gene flow to vary across the genome. Loci linked to sites under selection may experience reduced gene flow and may experience genetic bottlenecks by the action of nearby selective sweeps. Data from histories such as these may be poorly fitted by conventional neutral model approaches to demographic inference, which treat all loci as equally subject to forces of genetic drift and gene flow. To allow for demographic inference in the face of such histories, as well as the identification of loci affected by selection, we developed an isolation-withmigration model that explicitly provides for variation among genomic regions in migration rates and/or rates of genetic drift. The method allows for loci to fall into any of multiple groups, each characterized by a different set of parameters, thus relaxing the assumption that all loci share the same demography. By grouping loci, the method can be applied to data with multiple loci and still have tractable dimensionality and statistical power. We studied the performance of the method using simulated data, and we applied the method to study the divergence of two subspecies of European rabbits (Oryctolagus cuniculus).U NDERSTANDING speciation requires that we determine the role played by natural selection, as well as the roles of gene exchange and other demographic factors (Dobzhansky 1951;Maynard Smith 1966;Bush 1975;Endler 1977;Templeton 1981;Arnold 1997;Barton 2001). The genetic patterns of present-day populations potentially harbor much information about these processes, and in recent years investigators have developed sophisticated methods for quantifying different kinds of factors, including levels of gene flow between populations (Beerli and Felsenstein 1999;Nielsen and Wakeley 2001), admixture proportions (Chikhi et al. 2001), times of population separation (Nielsen and Wakeley 2001), and rates of population size change (Beaumont 1999;Hey 2005). This progress has been possible mainly through the development of full-likelihood model-based statistical methods that draw upon the coalescent theory of gene genealogies. However, quantifying the effects of selection in the divergence of populations has remained a challenging problem. Diffusion-theory-based methods can incorporate selection (Gutenkunst et al. 2009); however coalescent-based approaches to modeling selection do not readily admit to the kinds of flexibility required of divergence modeling (Hudson and Kaplan 1988;Neuhauser and Krone 1997;Wakeley 2008). As a result most of the model-based methods developed in recent years for studying divergence ignore the effects of selection and rely upon an assumption that neutral mutations and demography have been the sole determinants of patterns in the data (e.g., Kuhner et al. 1998;Beerli and Felsenstein 2001;Hey and Nielsen 2007 genome, ...