A rainforest bird known as the sapayoa often lives in commune-like extended family groups where members engage in both opposite-sex and same-sex mating, finds new research on the colorful birds.

Scientists studying the free-living Sapayoa in Panama have additionally determined that the birds’ closest relatives are species from across the ocean thousands of miles away in Asia and Africa. The researchers have no idea how the little birds, which do not normally travel so far, originally wound up in Central and South America.

Impressive Bird Flying Formations: Photos

“The Sapayoa is so different from other passerine (perching) birds that it is currently placed in its own family, Sapayoidae, but relatively little is known about its natural history,” Benjamin Van Doren, of Cornell University, said in a press release.

“This gap in scientific knowledge was the reason we traveled to eastern Panama to learn about this enigmatic species,” he added. “We hoped that more information about the Sapayoa’s natural history would cast its surprising evolutionary relationships in a new and clearer light.”

Van Doren, Sarah Dzielski and their team have since outlined the results of their expedition, reported in the journal The Auk: Ornithological Advances.

Pretty Plumage Sets These Shimmering Birds Apart: Photos

One of the nests they observed was attended by a family group of four that brought food to two chicks in residence. The researchers were surprised by the social behavior they observed, which included mounting between individuals of the same sex. The researchers suspect that such behavior evolved in the birds to establish dominance and to maintain social cohesion.

The scientists shared that many of the Sapayoa’s relatives from Africa and Asia are also cooperative breeders, getting help from family groups. Even the nests of all of these birds are distinctive, having a pear shape and often surrounded by foliage that hangs down like 60s door love beads.

The pear-shaped hanging nests found in Central and South America are similar to those of the birds’ Asian and African relatives. Collectively, all of the birds are known as suboscines. Their nests tend to be built over water along ravine-bottom streams.

Bird Lays Shimmering Egg that Changes Color

The researchers managed to study one communal bird family at the birds’ nest in Panama for more than 70 hours. The effort was part of a summer expedition to Darién National Park.

“Nest searching was always an adventure,” Dzielski said. “We found countless abandoned nests, and while checking inside for eggs or evidence that the nest was active, we found all sorts of surprises.”

“In a few instances,” she said, “a large grasshopper the size of a mouse hopped out from under the flap and scared the daylights out of us!”

In the future, the researchers hope to learn more about the free-spirited birds’ reproductive biology, social behavior and incredible trip across the globe from Africa and Asia to Central and South America.