Founded by the Phoenicians during the Persian period in the late sixth century BCE, Al Haram was inhabited continuously until the Crusader period.
The village was first recorded under its Greek name Apollonia in the final decades of the Persian period (mid-4th century BCE) and through the Hellenistic,
Roman, and Byzantine periods. During the Byzantine period, it was renamed to Sozusa in Palaestina to differentiate it from Sozusa in Libya. The renaming of
Apollonia "city of Apollo" to Sozusa (Σώζουσα Sōzousa, "city of the Savior") took place in the Byzantine period, under the influence of Christianity as the
state religion, motivated by Soter (Σωτήρ) "savior" being a byname of Apollo as well as of Christ. The renaming is paralleled in at least three other cities
called Apollonia: Sozusa in Cyrenaica, Sozopolis in Pisidia and Sozopolis in Thrace. The identification of ancient Apollonia with Byzantine-era Sozusa is
due to Stark (1852), that of medieval Arsuf with Apollonia/Sozusa to Clermont-Ganneau (1876).
During the Hellenistic period it was a port town ruled by the Seleucids. Under Roman rule, the town prospered and grew into the chief commercial and
industrial center of the region between the Poleg and Yarkon rivers.
In 113 CE, Apollonia was partially destroyed by an earthquake, but recovered quickly.
In 640, It fell to the Muslims who fortified it to defend it against Byzantine attacks and became known as Arsuf. The town's area decreased to about 22 acres
(89,000 m2) and, for the first time, it was surrounded by a fortified wall with buttresses, to resist the constant attacks of Byzantine fleets from the sea.
During this period of Muslim rule, Ali ibn Alil, known as Ibn Alim, lived in Arsuf. He was one of the most famous saints in the land of Palestine, attributed
to the second Caliph Rashidin Omar ibn al-Khattab, his seventh grandfather: Ali bin Alil bin Muhammad bin Yusuf bin Ya'qub bin Abdulrahman bin Abdullah bin
Amir al-Mu'minin Omar ibn al-Khattab. He was described as great scholar and miracle worker by Sultan Baybars' biographer, Muhyi al-Din (died 1292).
Ali Ibn Alim died in 1081 at the age of 47, and buried south of Arsuf in the village cemetery. His shrine and the Mosque which was built around it later
became the focal point of the village and later was renamed after him. According to Mujir al-Din who was a Jerusalemite qadi (Muslim Judge) and Palestinian
historian (c. 1496), the tomb was visited by Baybars in 1265. He prayed for victory there before retaking Arsuf from the crusaders.
In 1101, the village was conquered by the Kingdom of Jerusalem.
King Baldwin I captured it in 1102 after a siege by land and sea, allowing the inhabitants to withdraw to Escalon. The Crusaders, who called it Arsur
(Arsuf in Latin), rebuilt the city's walls and created the Lordship of Arsur in the Kingdom of Jerusalem.
On July 4th 1187, The Battle of Hattin took place between the Crusader states of the Levant and the forces of the Ayyubid sultan Saladin (Salah ad-Din).
It is also known as the Battle of the Horns of Hattin, due to the shape of the nearby extinct volcano of Kurûn Hattîn.
The Muslim armies under Saladin captured or killed many of the Crusader forces, removing their capability to wage war.
As a direct result of the battle, Muslims once again became the eminent military power in the Holy Land, re-conquering Jerusalem and many of the other
Crusader-held cities including Arsuf.
These Christian defeats prompted the Third Crusade, which began two years after the Battle of Hattin.
Al-Haram remained under Muslim rule until 1191 when it fell back into the hands of the Crusader army after the battle of Arsuf.
On September 7, 1191, the Battle of Arsuf took place with forces led by Richard I of England defeating a larger Ayyubid army led by Saladin.
The battle occurred just outside the city of Arsuf, when Saladin met Richard's army as it was moving along the Mediterranean coast from Acre to Jaffa,
following the capture of Acre.
The battle resulted in Christian control of the central Palestinian coast, including the port of Jaffa.
In 1265, Sultan Baibars captured Arsuf after 40 days of siege. Baibars was one of the commanders of the Muslim Egyptian forces that inflicted a defeat
on the Seventh Crusade of King Louis IX of France. He also led the vanguard of the Egyptian army at the Battle of Ain Jalut in 1260, which marked the
first substantial defeat of the Mongol army and is considered a turning point in history.
After its capture, Baibars demolished Arsuf’s fortresses and walls, fearing that the Crusaders would reoccupy it from the sea and fortify it again.
The city was left devastated, including the citadel except for the area south of the city where the shrine is. The mosque was built around it and the
people of the village resettled there.
The reign of Baibars marked the start of an age of Mamluk dominance in the Eastern Mediterranean and solidified the durability of their military system.
He managed to pave the way for the end of the Crusader presence in the Levant and reinforced the union of Egypt and Syria as the region's pre-eminent Muslim state,
able to fend off threats from both Crusaders and Mongols, and even managed to subdue the kingdom of Makuria, which was famous for being unconquerable by previous
Muslim empire invasion attempts. As sultan, Baibars also engaged in a combination of diplomacy and military action, allowing the Mamluks of Egypt to greatly expand their empire.