Sometimes the reason why one does something can be even more important than what was actually done. While our Sages note that one should strive to perform mitzvoth even for the wrong motives, the commentaries note exceptions to this rule (see, for example, a fascinating responsa of the Netziv , Meisheev Davar 1:46, in which he notes that the opening of new synagogues in an established neighbourhood is generally forbidden). It appears that such an exception is at work during the Exodus.
The ten plagues had (at least) two distinct motives. On a basic level, the plagues would induce Pharaoh to let the Jewish people leave Egypt . But had this been the sole, or even primary, reason for the plagues it would have been most practical to begin them with the death of the first born, the plague leading directly to the Exodus. The plagues, however, had an additional function: to serve as a demonstration of G-d's control of world events.
Pharaoh, and apparently the Jewish people too, lived with a pagan mindset in which the notion of a singular G-d was a foreign concept. "Through this you will know that I am G-d" (7:17). This knowledge was to lead Pharaoh to understand that his enslavement of the Jewish people was immoral. It was crucial that he not only free the slaves, but that he do so for the right reason. Had Pharaoh simply freed his slaves to save his empire, for economic or political reasons, it would have done little to ensure that G-d's name be spread throughout the world.
The Torah subtly hints that while Pharaoh may have been ready to let the Jews go free, it certainly would not have been for moral reasons. The fifth plague, that of dever ( pestilence), "destroys the entirety of the Egyptian livestock" (9:6) and Pharaoh hardens his heart. Nothing unusual here. However the cause of this hardening is rather startling. "And Pharaoh sent word and behold not a single animal had died from the Jewish livestock" (9:7). It was at this point that he hardened his heart. The inference is clear; had Jews suffered as the Egyptians did, he would have let them go.
Keeping the Jews enslaved was bad policy. His economy was in tatters, and the prudent move would have been to let them go. However, once he saw that the Jewish people had been spared suffering his ire was raised. Rather than focusing on the problems of his people, he was obsessed that this band of slaves should not be spared pain. Like many a despot, inflicting harm on others was of greater concern than helping the citizens of his own state. Tragically, it was precisely because the Jews had been spared that they were not allowed to leave, thereby prolonging the misery for all Egyptians.
Pharaoh's promises to let the people go were not based on moral necessity but on an erroneous cost-benefit analysis. And that would not do. The Jews would need to remain in Egypt a little longer to give Pharaoh time to understand why he had to let them go.
It is only at this point in the narrative that G-d actually began to harden the heart of Pharaoh. Up until then Pharaoh had quite capably done so himself. No rational person would let his country go to ruin under the increasing pressure of the plagues. His heart would need hardening, allowing him to ignore the practical reasons to let the Jews go. By the seventh plague this method was already having some effect, as Pharaoh for the first time admits "this time I have sinned, G-d is just" (9:27). Unfortunately this moral clarity did not last long and it took the death of many to effect the necessary change.
Although the Torah focuses on Pharaoh, it is we who need to take note of this message. Justice and morality must not be subject to pragmatic analysis and must be pursued even, or, shall we say, especially, when it is impractical to do so. That is the secret of redemption. May we merit it soon.