Mountain gorillas are friendlier to groups that they share a history with even after a decade of separation, according to new research.
Gorillas exist in close groups, foraging, resting and sleeping together around a "core home range" and a wider "peripheral" range.
But these groups sometimes split permanently, separating gorillas that may have lived together for years and may be closely related.
A study by the Dian Fossey Gorilla Fund and the University of Exeter show that these new factions are more than four times as likely to be genial to each other when they meet again, even if they had split more than a decade earlier.
However, gorillas tend to react aggressively when another group strays into their core territory - regardless of whether the intruders are familiar.
Dr Robin Morrison, of the Dian Fossey Gorilla Fund and Exeter's Centre for Research in Animal Behaviour, said: "Meetings of groups are fairly rare and at first both groups are usually cautious.
"They often beat their chests and show off their strength, but the interaction can then either become aggressive - with fighting and screaming - or 'affiliative'.
"In 'affiliative' interactions, the initial tension passes and the groups intermingle. They may rest together, and younger gorillas will often play with youngsters from the other group."
Humans have an unrivalled capacity for cooperation based on the friendships that extend beyond our immediate social circles.
The findings suggests that gorillas also maintain similar "friendships" between groups allowing shared access to space and resources with a reduced risk of aggression.
Dr Morrison added: "The pattern we found mirrors what we see in humans.
"We also have concepts of public spaces outside our 'range' where we tolerate anyone, spaces like our homes where we tolerate certain individuals, and private spaces within those homes reserved for close family or just ourselves."
Understanding these patterns could be helpful in "estimating future population dynamics and trends" among endangered gorilla habitats, according to the scientists behind the study.
The study, published in the Journal of Animal Ecology, used 16 years of data on the movement and interaction patterns of 17 mountain gorilla groups in Volcanoes National Park, Rwanda.
Australian Associated Press