attending its nest in a tree cavity Swallows are excellent flyers and use these skills to feed and attract mates. Some species, such as the
mangrove swallow, are
territorial, whereas others are not and simply defend their nesting sites. In general, the male selects a nest site, and then attracts a female using song and flight and (dependent on the species) guards his territory. The size of the territory varies depending on the species of swallow; in
colonial-nesting species, it tends to be small, but it may be much larger for solitary nesters. Outside the breeding season, some species may form large flocks, and species may also roost communally. This is thought to provide protection from predators, such as
sparrowhawks and
hobbies. Nonsocial species do not form flocks, but recently fledged chicks may remain with their parents for a while after the breeding season. If a human being gets too close to their territory, swallows attack them within the perimeter of the nest. Colonial species may mob predators and humans that are too close to the colony.
Diet and feeding For the most part, swallows are insectivorous, taking flying insects on the wing. In addition, the ease of capture of different insect types affects their rate of predation by swallows. They also avoid certain prey types; in particular, stinging insects such as
bees and
wasps are generally avoided. In addition to insect prey, a number of species occasionally consume fruits and other plant matter. Species in Africa have been recorded eating the seeds of
Acacia trees, and these are even fed to the young of the
greater striped swallow. The swallows generally forage for prey on the wing, but they on occasion snap prey off branches or on the ground. The flight may be fast and involve a rapid succession of turns and banks when actively chasing fast-moving prey; less agile prey may be caught with a slower, more leisurely flight that includes flying in circles and bursts of flapping mixed with gliding. Where several species of swallows feed together, they separate into different
niches based on height off the ground, some species feeding closer to the ground and others feeding at higher levels. Similar separation occurs where feeding overlaps with
swifts.
Niche separation may also occur with the size of prey chosen. In barn swallows, old mated males and young unmated males benefit from colonial behaviour, whereas females and mated young males likely benefit more from nesting by themselves. Pairs of mated swallows are monogamous, and pairs of nonmigratory species often stay near their breeding area all year, though the nest site is defended most vigorously during the breeding season. Migratory species often return to the same breeding area each year, and may select the same nest site if they were previously successful in that location. First-year breeders generally select a nesting site close to where they were raised. The breeding of temperate species is seasonal, whereas that of subtropical or tropical species can either be continuous throughout the year or seasonal. Seasonal species in the subtropics or tropics usually time their breeding to coincide with the peaks in insect activity, which is usually the wet season, but some species, such as the
white-bibbed swallow, nest in the dry season to avoid flooding in their riverbank nesting habitat. Overall, the contribution of male swallows towards parental care is the highest of any passerine bird. Begging calls are used by the young when soliciting food from their parents. The typical song of swallows is a simple, sometimes musical twittering. ==Status and conservation==