Genesis 50:20

NIV
New International Version

20You intended to harm me, but God intended it for good to accomplish what is now being done, the saving of many lives.