You intended to harm me, but God intended it for good, to accomplish what is now being done — the saving of many lives.
In context
18His brothers then came and threw themselves down before him. “We are your slaves,” they said. 19But Joseph said to them, “Do not be afraid. Am I in the place of God? 20You intended to harm me, but God intended it for good, to accomplish what is now being done — the saving of many lives. 21So then, do not be afraid. I will provide for you and your children.” And he reassured them and spoke kindly to them. 22Joseph stayed in Egypt, along with his father’s whole household, and he lived a hundred and ten years.