Aim: We evaluated how an elevation gradient affects: (1) the availability of food required by a specialist seed-eater, Loxioides bailleui Oustalet (Drepanidinae), or pallia, and hence the distribution of this endangered Hawaiian bird, and (2) the distribution of alien threats to Loxioides populations, their primary foods, and their dry-forest habitat, and hence strategies for their conservation. Location: We worked throughout the subalpine forest that encircles Mauna Kea Volcano, Hawai'i Island, but we focused our studies mainly on the western slope between 2000 and 3000 m elevation, where the gradient of elevation was greatest and palila were most abundant. Methods: We determined phenology and productivity patterns of the endemic dry-forest tree species, Sophora chrysophylla (Salisb.) Seem. (Fabaceae), or ma??mane, which provides Loxioides with most of their food, and another common endemic tree, Myoporum sandwicense A. Gray (Myoporaceae), or naio, which provides some resources, along a 786-m elevation gradient at monthly intervals for 10 years (Sophora only). We also determined the availability each month of moth larvae (Lepidoptera) for that were important in the diet of nestling and adult palila. In addition, we documented the incidence of parasitism on moth larvae by several wasp (Hymenoptera) and fly (Diptera) species, and we determined the distribution of predatory wasps and ants (Hymenoptera), which potentially threaten insect prey of birds. Percentage cover of alien grass species that pose fire threats in palila habitat and other weeds were assessed during one survey. Small mammal abundance and distribution were determined by trapping during three (rodent) or five (carnivore) surveys. Results: Sophora flower and seed (pod) availability varied predictably along the elevation gradient, with about 4 months separating peaks in reproduction at high and low elevations. This, together with highly variable production of flowers and pods within elevation strata, resulted in Sophora resources being available to Loxioides throughout the year on the western slope of Mauna Kea. Sophora produced flowers and pods more seasonally where gradients of elevation were short; thus, resources were available less consistently. In contrast, Myoporum produced flowers and fruits with little variation with respect to season or elevation. The availability of important insect prey of Loxioides was also related to elevation, in part because threats to Lepidoptera larvae from parasitic wasps were generally less at higher elevations. Threats to insect prey from predatory ants was also less at higher elevations but the abundance of predatory wasps was not related to elevation. Several weeds that pose the most serious threats to Loxioides habitat were more abundant at mid and low elevations, and alien grass cover was somewhat greater at mid elevation, thereby increasing fire risks in the centre of Loxioides habitat. Predatory mammals, in particular Felis catus Linnaeus, were common throughout the subalpine forest of Mauna Kea. However, Rattus rattus Linnaeus was rare, especially at higher elevations, whereas Mus musculus Linnaeus was more abundant at lower elevations. Main conclusions: Loxioides are concentrated in habitat that is distributed along a substantial gradient of elevation at least in part because food is available throughout the year and threats to food resources are less concentrated. To recover Loxioides elsewhere in its former range, habitats must be restored and alien threats reduced along extensive elevation gradients. Conservation along environmental gradients will likely benefit other Hawaiian birds that track the availability of food across landscapes or that have been stranded in the higher portions of their original ranges because of the greater impacts of alien diseases, predators, food competitors, and habitat stressors at lower elevations.