They peck at the pavement; they coo overhead; they swoop in hundreds across town squares: Pigeons have become such a permanent fixture in our urban landscapes that cities would seem oddly vacant without them.

But while many people harbor resentment for these ubiquitous creatures — labeling them "rats with wings" — few of us stop to ponder how pigeons became so numerous in the first place, and what our own role in their urban colonization might be.

Today, in fact, there are more than 400 million pigeons worldwide, most of which live in cities. But that wasn't always the case. The city pigeons we know today are actually descended from a wild creature known as the rock dove (Columba livia): As its name suggests, this bird prefers a rocky coastal cliff habitat to the conveniences of city life. [ Why Are Chickens So Bad at Flying? ]

But going as far back as 10,000 years ago, written and fossil records show that people living in ancient Mesopotamia (modern-day Iraq) and Egypt began coaxing these doves with food into human-inhabited areas, encouraging them to roost and breed on their land. "Back then, we brought rock doves into cities to eat as livestock," Steve Portugal, a comparative ecophysiologist who studies bird flight and behavior , told Live Science. The plump, young birds especially — known as "squabs" — became a prized source of protein and fat. People then began domesticating and breeding the birds for food, creating subspecies that led to the diversity of urban pigeons known today.

Along the way, humans began to realize that pigeons were useful for much more than their meat. As the birds grew more popular in the Middle East, North Africa and Western Europe in the ensuing centuries, people began to tap into their innate talent for navigation — the same skill that makes homing pigeons famous today. Ancient records show that Mediterranean sailors used the birds to point floundering ships toward land . In cities, they became increasingly valuable as airborne messengers that could deliver important information across large distances.

From there, humanity's appreciation for the animals only grew: Although pigeons were initially domesticated as a food source, "as other poultry became more popular, pigeons fell out of favor for eating and people began breeding them as a hobby," said Elizabeth Carlen, a doctoral student at Fordham University in New York City who studies the evolution of urban pigeons.

By the 1600s, rock doves — non-native to the United States — had reached North America , transported by ships in the thousands. Rather than being a food source, it's most likely that the birds were brought across from Europe to satiate the growing pigeon-breeding trend among hobbyists, said Michael Habib, a paleontologist in the Dinosaur Institute at the Los Angeles County Museum of Natural History, and the University of Southern California.

Inevitably, birds escaped captivity, and began to breed freely in American cities. "We created this novel [urban] habitat and then we basically engineered an animal that does very well in that novel habitat," Habib told Live Science. "They were successful in cities because we engineered them to be comfortable living around humans." [ Do Birds Really Abandon Their Chicks If Humans Touch Them? ]

Cities became the perfect backdrop for the pioneering pigeons' success. "Pigeons are naturally cliff-dwellers and tall buildings do a pretty great job at mimicking cliffs," Carlen told Live Science. "Ornate facing, window sills and air-conditioning units provide fantastic perches for pigeons, similar to the crevices found on the side of a cliff."

Another trait that makes pigeons more adaptable is their appetite. While other bird species have to rely on supplies of berries, seeds and insects, pigeons can eat just about anything that humans toss in the trash . "Other species are specialists and pigeons are the ultimate generalists," Portugal said. "And the food is endless: I don't think too many pigeons go to bed hungry!"

The pigeon's unusual breeding biology seals the deal: Both parents rear their chicks on a diet of special protein- and fat-rich milk produced in a throat pouch called the crop. So, instead of having to rely on insects, worms and seeds to keep their young alive — resources that would be scarcer in cities — pigeons can provide for their offspring no matter what, Portugal says: "As long as the adults can eat, they can feed their babies , too."

All these traits give pigeons a competitive edge compared with other species that might attempt survival in cities. Combined with the pigeon's prolific breeding habits (parents can produce up to 10 chicks a year), it's easy to see why these birds have become so populous around the world.

Not everyone appreciates the urban phenomenon that these birds have become — hence the "rat with wings" moniker. That's understandable to some extent: Pigeons can spread diseases , and the mounds of guano they splatter across buildings can be cumbersome and costly to clean.

Despite this, Portugal sees a benefit to their presence in our urban environments. "They're actually one of the few bits of wildlife that people get to interact with in cities now," he said. What's more, "they're super-adaptable and super-successful; they're the ultimate survivors. Actually, we can learn a lot from them."

Originally published on Live Science.