A Question of Omnipotence

Assuming there is such thing as an omnipotent God, one that gives us free will, then we can surmise he didn’t cause the tragedy at Sandy Hook.

My question is, couldn’t an omnipotent being, knowing it was going to happen, prevent it? Is our having free will so important it requires the taking of innocents?

If he could, as omnipotence would imply, but didn’t, it paints a troubling portrait of an all-knowing, all powerful God and his intentions towards his “children”.

If he couldn’t, further unveiling the myth of omnipotence, what good is prayer?