Exodus 13:17

Then it came to pass, when Pharaoh had let the people go, that God did not lead them by way of the land of the Philistines, although that was near; for God said, "Lest perhaps the people change their minds when they see war, and return to Egypt."