Optimus prime shot a human with a transformers gun in one of the movies. I had to blink several times to process what happened.
Prime has been evil since part 2.
I am partial to the theory that Prime legitimately is evil in the films, having been driven mad by war, and that it's all on purpose by Bay. Megatron really isn't that bad in the movies either. He's evil, sure, but it's because he wants to save his people and planet which are legitimately dying.