In the Battle of Kadesh , where he led Egyptian armies against those of the Hittite king Muwatalli II . He was caught the first recorded military ambush , but could win the battle nevertheless . His campaigns of reconquest culminated in the Battle of Kadesh , where he led Egyptian armies against those of the Hittite king Muwatalli II and was caught in history 's first recorded military ambush , but thanks to the arrival of the Ne ` arin , Ramesses was able to rally his troops and turn the tide of battle against the Hittites .