Dynasties XXVIII, XXIX and XXX 

A great number of Egyptian princes and leaders fought against the Persian occupation. They tried to make alliance with the Greeks, offering them large quantities of wheat. Nevertheless, the Greeks signed a peace treaty with the Persians. The Egyptians, led by Amun-her, Anaros, and at last Amiritaius were able to defeat the Persians and get revenge of their allied the Jews who resided in Elephantine Island. Dara II had to recognize the Egyptian independence and Amiritaius became the first and the only king of the Twenty-eight Dynasty.
After the death of Amiritaius, Naif-Au-Rod (Nefertis I) founded the Twenty-nine Dynasty (According to Manetho) and ruled Egypt for 20 years from the city of Mendes. The Twenty-nine Dynasty Kings tried to make alliance with the Spartans and the Greeks against the Persians, and they restored the destructed temples.
Nectanebo I usurped the throne and founded the Thirtieth Dynasty which ruled Egypt for 37 years (380-343 BC). During the reign of this dynasty, the country was unified and the temples restored. During the reign of Nectanebo I, the Persians invaded Egypt with thousands of Persian and mercenary Greek soldiers but they were unsuccessful because of the floods, and they had to withdraw back to Asia. Jed-Her made alliance with the Spartans and the Greeks against the Phoenicians but he was defeated and exiled to Persia. Nectanebo II ruled Egypt for 17 years, until the Persians, led by Artkserksis III (Ochus) invaded Egypt, and he had fled to Nubia. The Persian occupation lasted 11 years, until Alexander defeated them and made Egypt a part of his vast empire.