Self-interest led his ministers to make serious preparations to meet the attacks of
Antiochus III the Great on
Coele-Syria including
Judea, and the great Egyptian victory of
Raphia (217), where Ptolemy himself was present, secured the northern borders of the kingdom for the remainder of his reign. The arming of
Egyptians in this campaign had a disturbing effect upon the native population of Egypt, leading to the secession of Upper Egypt under pharaohs
Harmachis (also known as
Hugronaphor) and
Ankmachis (also known as
Chaonnophris), thus creating a kingdom that occupied much of the country and lasted nearly twenty years.