Can one form a friendship with a magpie – even when adult males are protecting their nests during the swooping season? The short answer is: “Yes, one can” – although science has just begun to provide feasible explanations for friendship in animals, let alone for cross-species friendships between humans and wild birds.

Ravens and magpies are known to form powerful allegiances among themselves. In fact, Australia is thought to be a hotspot for cooperative behaviour in birds worldwide. They like to stick together with family and mates, in the good Australian way.

Of course, many bird species may readily come to a feeding table and become tame enough to take food from our hand, but this isn’t really “friendship”. However, there is evidence that, remarkably, free-living magpies can forge lasting relationships with people, even without depending on us for food or shelter.

When magpies are permanently ensconced on human property, they are also far less likely to swoop the people who live there. Over 80% of all successfully breeding magpies live near human houses, which means the vast majority of people, in fact, never get swooped. And since magpies can live between 25 and 30 years and are territorial, they can develop lifelong friendships with humans. This bond can extend to trusting certain people around their offspring.

A key reason why friendships with magpies are possible is that we now know that magpies are able to recognise and remember individual human faces for many years. They can learn which nearby humans do not constitute a risk. They will remember someone who was good to them; equally, they remember negative encounters.

Why become friends?

Magpies that actively form friendships with people make this investment (from their point of view) for good reason. Properties suitable for magpies are hard to come by and the competition is fierce. Most magpies will not secure a territory – let alone breed – until they are at least five years old. In fact, only about 14% of adult magpies ever succeed in breeding. And based on extensive magpie population research conducted by R. Carrick in the 1970s, even if they breed successfully every single year, they may successfully raise only seven to eleven chicks to adulthood and breeding in a lifetime. There is a lot at stake with every magpie clutch.

Read more: Bird-brained and brilliant: Australia's avians are smarter than you think

The difference between simply not swooping someone and a real friendship manifests in several ways. When magpies have formed an attachment they will often show their trust, for example, by formally introducing their offspring. They may allow their chicks to play near people, not fly away when a resident human is approaching, and actually approach or roost near a human.

In rare cases, they may even join in human activity. For example, magpies have helped me garden by walking in parallel to my weeding activity and displacing soil as I did. One magpie always perched on my kitchen window sill, looking in and watching my every move.

On one extraordinary occasion, an adult female magpie gingerly entered my house on foot, and hopped over to my desk where I was sitting. She watched me type on the keyboard and even looked at the screen. I had to get up to take a phone call and when I returned, the magpie had taken up a position at my keyboard, pecked the keys gently and then looked at the “results” on screen.

The bird was curious about everything I did. She also wanted to play with me and found my shoelaces particularly attractive, pulling them and then running away a little only to return for another go.

Importantly, it was the bird (not hand-raised but a free-living adult female) that had begun to take the initiative and had chosen to socially interact and such behaviour, as research has shown particularly in primates, is affiliative and part of the basis of social bonds and friendships.

Risky business

If magpies can be so good with humans how can one explain their swooping at people (even if it is only for a few weeks in the year)? It’s worth bearing in mind that swooping magpies (invariably males on guard duty) do not act in aggression or anger but as nest defenders. The strategy they choose is based on risk assessment.

A risk is posed by someone who is unknown and was not present at the time of nest building, which unfortunately is often the case in public places and parks. That person is then classified as a territorial intruder and thus a potential risk to its brood. At this point the male guarding the brooding female is obliged to perform a warning swoop, literally asking a person to step away from the nest area.

If warnings are ignored, the adult male may try to conduct a near contact swoop aimed at the head (the magpie can break its own neck if it makes contact, so it is a strategy of last resort only). Magpie swooping is generally a defensive action taken when someone unknown approaches who the magpie believes intends harm. It is not an arbitrary attack.

When I was swooped for the first time in a public place I slowly walked over to the other side of the road. Importantly, I allowed the male to study my face and appearance from a safe distance so he could remember me in future, a useful strategy since we now know that magpies remember human faces. Taking a piece of mince or taking a wide berth around the magpies nest may eventually convince the nervous magpie that he does not need to deter this individual anymore because she or he poses little or no risk, and who knows, may even become a friend in future.

A sure way of escalating conflict is to fence them with an umbrella or any other device, or to run away at high speed. This human approach may well confirm for the magpie that the person concerned is dangerous and needs to be fought with every available strategy.

In dealing with magpies, as in global politics, de-escalating a perceived conflict is usually the best strategy.