Ascalon was Fatimid Egypt's greatest and most important frontier fortress. The Battle of Ascalon was fought outside the city in 1099 in the aftermath of the First Crusade and the fall of Jerusalem to the Crusaders. Although the crusaders were victorious, internal disputes in their camp allowed Ascalon to remain in Egyptian hands. Thereafter, the Fatimids were able to launch raids into the kingdom every year from this fortress, and the southern border of the crusader kingdom remained unstable. If this fortress fell, then the gateway to Egypt would be open. Therefore, the Fatimid garrison in Ascalon remained strong and large.
After the failure of the Second Crusade in 1148, Conrad III of Germany attempted to besiege the fortress, but was forced to withdraw when no help was forthcoming from Jerusalem or other crusaders. Meanwhile, the territory to the east and north of Jerusalem was united under Nur ad-Din Zangi, who ruled Mosul and Aleppo and brought Damascus under his influence after the Second Crusade. In 1149 Nur ad-Din defeated the Principality of Antioch at the Battle of Inab. Nur ad-Din was unable to overrun Antioch entirely, nor was he able to penetrate far into the Kingdom of Jerusalem, but likewise there was little Jerusalem could do in the north and the east with the whole area united under one strong ruler. The crusader kingdom would have to look towards Egypt if they wanted to expand.
Around 1150, Baldwin III of Jerusalem rebuilt the Gaza City, which at that point lay in ruins. The city was handed over to the Knights Templar, and provided some defense against the continual raids from Ascalon, 10 miles (16 km) to the northeast. Since the establishment of the kingdom, other fortresses had also been built to watch Ascalon. These were Ibelin (Yibneh) about 20 miles (32 km) northeast of Ascalon near the coast, Blanchegarde (Tell es Safi) about 15 miles (24 km) east-northeast, Beth Gibelin (Bait Jibrin) about 19 miles (31 km) east and
Montgisard near Ramla 28 miles (45 km) to the northeast.
However, Jerusalem itself was soon divided by civil war. Baldwin III was the legal heir to the kingdom, but his mother Queen Melisende had been ruling as regent since 1143. In 1152 Baldwin finally demanded full control of the kingdom; after some brief fighting he was able to accomplish this goal. Later that year Baldwin also defeated a Seljuk Turkish invasion of the Kingdom. Encouraged by these victories, Baldwin decided to make an assault on Ascalon in 1153. With the entire army of Jerusalem he marched to the fortress and began to destroy the surrounding orchards in January. Patriarch Fulcher was also present, along with Raymond du Puy de Provence and Bernard de Tremelay, the masters of the Hospitallers and Templars respectively, and all the other great barons of the kingdom, including Hugh of Ibelin, Philip of Milly, Humphrey II of Toron, and Raynald of Châtillon. The siege was undertaken both by land and by sea, with the fleet commanded by Gerard of Sidon. The crusader force was also bolstered by a large group of pilgrims, who happened to be on their way to Jerusalem at the time.
On the Fatimid side, the city was garrisoned by members of the local Kananiyya tribe, as well as a cavalry contingent from Cairo, some 400 to 600 strong, that was rotated into the city every six months. In response to the Crusader attack, the vizier Ibn as-Sallar began preparing reinforcements for the city in March, as well as a naval expedition. The army set off and got as far as Bilbays, while Ibn al-Sallar supervised the final preparations of the fleet, including a naval review and the payment of the crews. The army commanders at Bilbays, led by Ibn al-Sallar's stepson
Abbas ibn Abi al-Futuh, hatched a plot to kill the vizier, which was carried out on 3 April. The army returned to Cairo, where Abbas became vizier, leaving Ascalon largely to its fate. The Fatimid fleet sailed to Ascalon and easily dispersed the weak Crusader squadron of 15 ships, but as the city's harbour was unsuitable for sustaining a fleet for long periods of time, it had to return to Egypt.
Siege towers were constructed, and for five months there were many skirmishes and victories and defeats on both sides. Ascalon was vast and virtually impenetrable; behind its massive walls and gates were twice as many defenders as there were besiegers outside, and there were supplies of food to last for years. In May the Egyptian fleet arrived to resupply the city; Gerard of Sidon's little fleet could do nothing to stop them. However, a setback for Ascalon occurred in August when the besieged tried to burn down one of the crusader siege towers; the wind pushed the fire back against their own walls, causing a large section to collapse. According to William of Tyre, knights of the Order rushed through the breach without Baldwin's knowledge while Bernard de Tremelay and about forty of his Templars were killed by the larger Egyptian garrison. Their bodies were displayed on the ramparts and their heads were sent to the caliph in Cairo. In a differing account by a Damascene chronicler in the city, the breach of the wall is simply mentioned as a precursor to the fall of the city; he makes no mention of the incident with the Templars. Because of William of Tyre's dislike of the Order, and the wildly inaccurate news that reached Europe during the crusades, his account must be treated with caution; but regardless of which account is believed, Bernard was killed during the fighting.
By now the crusaders were becoming fatigued and it was suggested that they abandon the siege. The Hospitallers and the Patriarch, however, convinced the king that they were on the verge of victory. Three days later another assault was made, and another entrance was forced. After bitter fighting the city fell to the crusaders on August 19, and the fortress was formally surrendered to them three days later. The citizens were allowed to leave in peace; most fled back to Egypt.