There is a novel, and damned if I can remember the title, where a rabi proposes that god commanding Abraham to kill his son was a test, which he (Abraham) failed.
My understanding of the story (in the novel, which I still can't remember the name) was that in knuckling under to the command to murder his own child, Abraham failed the test.
Ha! Just remembered the name of the novel. Hyperion by Dan Simmons. The Rabies name was Sol Weintraub, for what that's worth. OK, now I can think about something else...
The implication I’m making is that a moral deity that allows free will might allow bad things to happen as a test for people to act morally. Religion, instead has been at the root of problems and/or stood by while bad people do bad things.
However, Religion is not a body in and of itself but we talk about people. I cannot and will never defend religious people wholesale because they are people and all people make mistakes. However to attribute mistakes to religion, one has to prove that said religion says to commit that mistake.
What I defend is religion, in this instance Islam, and would ask those who attribute a problem to it to provide first the evidence that it is indeed encouraging it.
In all fairness I would like to point out that statistics show that atheists were responsible for the most killings in human history.