Hi Mahendran,
I am not really sure how this works and the technicalities of it but if we look at it in the following manner it makes a bit more sense.
Humans are above animals in their good deeds and intentions, but not all humans are of good nature. They got to being a human because of a good kamma but how they react will differ from person to person. So this could be the same for Devas as well.
Again even a human who is predominantly good can do harm to others sometimes. Someone can look at person A and say he such a good human being, he does so many good deeds and so on. But in some instances that same person A might do harm to others for some reason. Another example is that some people give arms to beggars but not to monks or vice versa. I guess things like this could also happen with Devas.
So generally we can say that devas are beings with good morals and intentions, but there can be instances where this does not hold.