This is going to be quick as I want to get going to prayer meeting tonight, but I just thought of this analogy/explanation to get past a stumbling block many encounter when understanding or even believing in God.
I got the realization how I can help with this problem when I started thinking of some anti-religious and anti-God comments in an online news article. They, posted by the usual advocates of non-belief in God etc, took the familiar tack of citing every time God smited or punished someone in the Bible, or encouraged the Israelites to kill and conquer the natives of Canaan, as evidence that God is "mean" or "cruel." Hmm, I've heard this so many times and rather than the usual way of approaching the truthful explanation, here's an analogy.
Suppose you are a parent and someone asks you why you had a child. Suppose you answered them "So I could pay for them going to college." What? That's not even biologically honest, LOL. A parent had a child because 1) they had sex and a child resulted. I mean, that's the bottom line, no? Whether the child is loved or not, wanted or not, treated well or not, the "reason" every parent has a child is that they had sex with someone who was fertile. Duh!
One would never explain that one had a child by giving the questioner a snapshot of what you are doing with that child in the present moment, in this analogy, paying for a college education.
When one tries to understand God by citing difficult to understand actions that occur well along in the relationship between God and humans, one is making the same error. The only way to understand God (and even the "bad" parts of the relationship) which is to start in the beginning, which is love. You must understand God by understanding his foundation with human beings is love.
The proof is in the existence of both the angels and first humans, Adam and Eve. God did not create the angels so that he could have difficulty with them later. He created them, let them choose to serve or not, and those who chose not to serve him followed their leader, Lucifer, to the world, and to their abode hell. (Notice Lucifer spends very little time in hell, since he wanders the earth, while the others are all stuck in hell). So God created unbelievably immense numbers of angels (beyond quadrillions of them) out of love, not because he wanted to combat with the handful that refused to serve him.
Likewise Adam and Eve were created and God made known in his understandable true form to them for love and companionship. It was a fertile relationship, like the angels, where the fertility is love. God did not create humans so he could boss them around, be mean to them, or play games with them, or to have to pay for their college (!)
So whenever someone (maybe yourself) is tempted to try to understand God by starting out with listing with your own righteous indignation all the "bad" and "mean" things God did, and thus must supposedly be, and hence just a trick to make humans obey law and doesn't really exist, think of my analogy to bail you out of that error in mindset and time frames. Did a parent have a child just so he or she could pay tens of thousands of dollars to a college someday? That's what they had in mind when the baby was conceived? "Hey, I want to give $50,000 to NYU, so let's have a baby and send the baby to NYU!" Duh, no. God created angels and humans out of the fertile and mutual love that God is in his totality of existence. Listing the hardships, "payments" and "mean discipline" that God rendered later hardly begins to truly enlighten anyone to God's true nature.
I hope you have found this helpful! (Hi young friends, always thinking of you...)