Decreasing populations of farmland birds have been reported throughout NW Europe. This study aims at identifying habitat elements of importance for the maintenance of a rich avifauna in agricultural areas. Using data from the Danish breeding birds monitoring programme, based on point counts, 706 census points situated in farmland and censused during the years 1990-1993 were selected. The landscape around each point was described quantitatively with respect to general habitat composition, area and structure of habitat islands, and length and structure of linear habitat elements. Bird-habitat relationships were analysed by means of canonical correlation analysis and multiple regression. The number of species was negatively correlated with distance to permanent grassland, wetland and wood, and positively correlated with area of buildings and gardens, dry habitat islands (coverts) and wet habitat islands with woody plants. A number of associations between individual species and habitat elements were found and are described in the paper. Two major species groups may be distinguished: species connected with open countryside and species connected with woody vegetation in gardens, hedgerows and/or habitat islands. A review of the population trends indicates that the declines have mainly occurred within the former group.