Our Sovereign God
So now it was not you that sent me hither, but God: and he hath made me a father to Pharaoh, and lord of all his house, and a ruler throughout all the land of Egypt. Gen. 45:8
Joseph's brothers sold him into slavery out of jealousy and hatred. The slavers had then sold him in Egypt, where Joseph met with various further hardships, including being falsely accused of rape and imprisonment, until he was given the opportunity to interpret Pharaoh's dreams and be raised to the position of authority which he then enjoyed. So there was certainly a real human reason why Joseph was where he was. In fact, in the previous verses, we are told that he admits as much: "ye sold me hither" (5).
But at the end of the day, Joseph recognized what a lot of folks today don't seem able to: that God is the ultimately decisive reason why things are the way they are, including things that we normally think of as bad. It was bad that Joseph's brothers sold him into slavery, a moral evil, and yet Joseph doesn't hesitate to say that through it all God was the one sending him into Egypt.
Of course, God does not stand behind evil in the same way he stands behind good. God never directly brings evil about; he never creates the sinful desire in human hearts - that is totally on us (cf. Jam. 1:13-15). Also, God never stands behind evil for the reasons that men do: what wicked men may mean for evil, God means for good (Gen. 50:20). But God is sovereign and nothing happens in this universe apart from his will. Is evil permitted by God? Yes, and for wise and holy purposes. God is never taken by surprise and he is never in heaven wringing his hands trying to figure out how to fix what we've messed up. Rather, our God is in the heavens and he has done whatsoever he has pleased (Ps. 135:5-6).
This is not an excuse for our sin, for God who permits sin will also punish it (cf. Mt 26:24). We don't take this truth of God's sovereignty over all things to give ourselves an excuse for sin; we take it as a reason to have peace in a world that seems so chaotic. We wish things would turn out in a certain way and they don't: and then we panic. But God is still on the throne and he has never for a moment lost control. We can trust in him and rest in his power and wisdom to bring all things about for the good of his people and the glory of his name.
So today, don't let the panic of unbelief rule you; let the peace of our sovereign and good and powerful and wise and saving God fill you with unshakeable hope and unbreakable joy.