either God did it or permitted it.
God's perfect will or God's permissive will
And we know that all things work together for good to them that love God, to them who are the called according to [his] purpose. - Romans 8:28
Given this, one of my favorite verses BTW, Are there really any mistakes or errors in a child of God's life?
After all, some kids really, really, really need to touch the stove to know it is hot.