Abstract Urbanization causes wildlife habitat loss, fragmentation, and the replacement of specialist species by generalists and/or exotic taxa. Because mesocarnivores are particularly vulnerable to habitat modifications, the rapid expansion of urban areas and the increasing trend for ex-urban development occurring in Mediterranean ecosystems may be major drivers of change in mesocarnivore communities. We combined camera trapping and sign surveys to quantify the richness and relative abundance of a set of wild and domestic mesocarnivores. We quantified these variables controlling for the gradient of urbanism, ex-urbanism, and other environmental variables in patches of natural vegetation in the region of Madrid (central Spain), and a non-urbanized control area ~220 km south of Madrid city. Using conditional autoregressive models (CAR) and model selection procedures, we found that urbanization influenced mesocarnivore community composition but this influence was not detrimental for all the species tested. Generalist carnivores such as the red fox Vulpes vulpes were more abundant in urban and ex-urban areas. Ex-urban development creates overlapping areas between wild and domestic species (such as the domestic cat Felis catus and the wildcat Felis silvestris) but contact between wild and domestic carnivores in natural areas is unlikely. Detection of species in the control area was very low. Therefore, the impact of urbanization in causing changes in mesocarnivore communities may be less than other factors such as illegal predator culling.