not had a problem with magpies - but a male pheasant pinned one of my hens down once
not sure if he thought it was a female pheasant !!!
but boy did he leg it when my cockerel spotted him - the cock chased him right out the garden and even flew over the fence after him as he took off
so I would say its a territory thing