I could have stretched forth My hand and stricken you [Pharaoh] and your people with pestilence, and you would have been effaced from the earth. Nevertheless I have spared you for this purpose: in order to show you My power and in order that My fame may resound throughout the world.

Exodus 9:15-16

Plague of locusts
As with previous plagues, Moses came to Pharaoh and warned him of the impending plague of locusts. Pharaoh's officials begged him to let the Israelites go rather than suffer the devastating effects of a locust-swarm, but he was still unwilling to give in. He proposed a compromise: the Israelite men would be allowed to go, while women, children and livestock would remain in Egypt. Moses repeated God's demand that every last person and animal should go, but Pharaoh refused.

Plague of darkness
This plague was an attack aimed directly at Pharaoh's god Ra, the Egyptian sun god. By introducing the plague of darkness, Moses attempted to demonstrate the clear power of Yahweh; and the folly of worshipping the Egyptian gods.