The study of the ecological condition of soils in small towns as a factor of sustainable development of territories is substantiated. Various samples were collected from the territories of small towns in the Leningrad Oblast (Russian Federation) and the suburbs of St. Petersburg (for example, the town of Pushkin). The influence of the city size and population number on the processes of soil pollution is considered on the basis of the generalized data. Quantitative information about the accumulation of metals by soils in different categories of settlements is given. The concentration of certain elements in soils in the cities grouped by the number of inhabitants is determined, as well as the environmental hazards of pollution. The ecological hazard of the accumulation of chemical elements in soils and the primary role of Pb and Zn as pollutants in all cities are considered. The accumulation in the soil cover in significant concentrations of Cd, Co and Ca, which significantly change the ecological and geochemical situation in urban landscapes, has been noted. It was determined that such elements as As, Cu and Cl are the key ecological-geochemical pollutants in four groups of settlements. Groups of settlements with different values of the absolute variation of element concentrations have been established.