Forest fragmentation may benefit generalist herbivores by increasing access to various substitutable food resources, with potential consequences for their population dynamics. We studied a European roe deer (Capreolus capreolus) population living in an agricultural mosaic of forest, woodlots, meadows and cultivated crops. We tested whether diet composition and quality varied spatially across the landscape using botanical analyses of rumen contents and chemical analyses of the plants consumed in relation to landscape metrics. In summer and non-mast winters, roe deer ate more cultivated seeds and less native forest browse with increasing availability of crops in the local landscape. This spatial variation resulted in contrasting diet quality, with more cell content and lower lignin and hemicellulose content (high quality) for individuals living in more open habitats. The pattern was less marked in the other seasons when diet composition, but not diet quality, was only weakly related to landscape structure. In mast autumns and winters, the consumption of acorns across the entire landscape resulted in a low level of differentiation in diet composition and quality. Our results reflect the ability of generalist species, such as roe deer, to adapt to the fragmentation of their forest habitat by exhibiting a plastic feeding behavior, enabling them to use supplementary resources available in the agricultural matrix. This flexibility confers nutritional advantages to individuals with access to cultivated fields when their native food resources are depleted or decline in quality (e.g. during non-mast years) and may explain local heterogeneities in individual phenotypic quality.