While Moses was traveling back to Egypt, the Lord spoke to him, “When you talk to Pharaoh remember to show him all the miracles that I have given you the power to do. But I will cause Pharaoh to be very stubborn. He will not let the people go.
“God made the people blind. He closed their minds. He did this so that they would not see with their eyes and understand with their minds. He did it so that they would not turn and be healed.” Isaiah 6:10
That is why Moses and Aaron did all these great miracles in front of Pharaoh. And that is why the Lord made Pharaoh so stubborn that he would not let the Israelites leave his country.
The Israelites were leaving with their arms raised in victory. But the Lord caused Pharaoh, the king of Egypt, to become brave. And Pharaoh chased the Israelites.
The Lord made those people feel brave enough to fight against Israel. This was so that Israel could destroy them completely without mercy just as the Lord had commanded Moses to do.