Ultron was meant to be a hero and keep the world safe but the AI went wrong and he decided to have peace on Earth all the humans had to die. I mean, I get where he's coming from with all the wars in human history that are from differences in politics or religions. But he kinda went way extreme.
But really, can you honestly blame Ultron being made to take on the world ending threats instead of the Avengers, a lot of whom were just thrown into extraordinary circumstances and had no choice but to step up?