A drought-tolerant perennial herb of well-drained, often nutrient-enriched soils in unshaded situations, found on roadsides, railway banks, waste ground and field-borders, often near settlements, around farms and in the shelter of walls, occasionally on sea-cliffs. It reproduces freely from seed. Lowland.
There has been little change in the distribution of this species since the 1962 Atlas.
As an archaeophyte M. sylvestris has a Eurosiberian Southern-temperate distribution, but it is widely naturalised so that its distribution is now Circumpolar Southern-temperate.