Moses made 10 plagues (the last one was the death of the first born son) towards the Egyptians so they would free the Israelites as the Pharaoh already said no, he ended up freeing them and parted the sea after the Egyptians regretted their decision to let them go.