The computer cant determine who is stronger and who is going to be annhilated, they always go with who attacks and then they terminate their alliance/protectorate with that group.