"The Lord did not guide them through the land of the Philistines, lest they see war and return to Egypt," we are told in the book of Exodus. This is strange, considering the fact that they will see war sooner rather than later in any event. In fact, shortly after they finished crossing the Red Sea, they are forced to do battle with Amalek!
But, before that, there is a much more fundamental question. After all, had the Israelites gone via the Philistine territories, they would have witnessed the splitting of the Red Sea. That miracle, considered by the Hagadah of Passover to be five times more significant than the 10 plagues, would never have happened! Why, then, does God need to explain His reason for avoiding the land of the Philistines as relating to war? They needed to go to the Red Sea in order to witness that earthshaking miracle!
The Katav Sofer offers a powerful explanation. Earlier in Exodus, the people do not believe Moses's news about the upcoming redemption "from shortness of breath and hard labor." The Rabbi explains the psychology. If you tell someone who is suffering that their situation will improve slightly, they will believe you and welcome the news. If you tell them that they will have a complete recovery within 24 hours, they will most probably reject what you say as false comfort.
The Israelites were suffering so tremendously that the only news they could handle would be of some improvement in their situation. It's enough to tell them that they will be eventually leaving Egypt. That, they might believe. But to tell them that there would be tremendous miracles and wonders, 10 plagues and the splitting of the sea, would be too much for them to accept. And so it was. Someone who is in such a low situation is incapable of believing in anything more than a moderate improvement in their situation.
Thus, says the Rabbi, the newly freed slaves will still be unable to trust in their own future. They will not have faith in the face of something terrible that they have never seen before: war. They will immediately run to that which is familiar, to Egypt. It's not that they are bad people, it's that nothing in their experience has prepared them for the possibility that they could actually fight and win a war! It is simply too much to ask for them to accept.
All of that changed at the Red Sea. When Israel witnessed God split the sea, and drown the Egyptians in it, their view of what is possible changed completely. "The maidservant at the sea saw more than the prophet Ezekiel in his prophecies," say our sages. They now know that God is capable of anything in this world, and that they are on His team.
When the Jewish people arrive at Mount Sinai, God tells Moses that they shall be "a kingdom of priests." In other words, every Israelite will be both a king and a priest. What does this mean? Why this strange combination? Let's look at a king first. This is practical, for we all have the potential to become kings.
What defines a king? Simply, the ability to rule a people and get things done. The king gives an order, it must be carried out. It is potential and power. The Israelites became like kings at the splitting of the sea because they now believed in the power of God, and themselves as God's people, to create tremendous change in the world. And, indeed, Jews have been changing the world from then on. But, if the king rules his people, who rules the king? Who, or what, tells him what to do?
Kings are certainly guided by policy, tradition, advisers and so forth. But the main thing that guides the king is his goal and purpose as being king. A king dedicated to his own glory and wealth, as history has known so many times, will be a tyrant and an oppressor. A king guided by the desire to protect and advance his people will be a benevolent king.
This is where the concept of "priest" comes into play. A priest is dedicated to the service of God. He is a servant. Thus, a king who regards himself as a servant of his people and his God will fulfill his role magnificently. This is the task of the Jewish people. We must be kings, aware of our potential to change the entire world. At the same time, we must regard ourselves as priests, as servants of God. We must let Him define our goals, the goals that guide us in our "kingdoms." God wishes to protect and advance humanity, to improve it and bring it to a state of peace and goodness.
Thus, the detour to the Red Sea prepared the Israelites for the wars that would start in just a few days and weeks. The difference was, now that they saw God's potential and power, they were capable of believing in their eventual ability to prevail. They became kings, and next turn their steps towards Mount Sinai, where they will become priests as well. This is the Jewish mission in every generation: to believe in God and achieve the impossible.