In 1177 the Crusader kingdom was facing the prospect of a succession crisis. King Baldwin IV was a leper and could not leave an heir. His sister Sibylla had been left widowed and pregnant by William of Montferrat, and the nobles of the kingdom began to seek another suitable husband. At the same time, Philip of Alsace, Count of Flanders, arrived on pilgrimage, and demanded that Sibylla be married off to one of his vassals. Philip and Baldwin also planned an alliance with the Byzantine Empire for a naval attack on Egypt; but none of these plans came to fruition.
Meanwhile, Saladin planned his own invasion of the kingdom from Egypt. Learning of Saladin's plans, Baldwin IV left Jerusalem with, according to William of Tyre, only 375 knights to attempt a defense at Ascalon, but Baldwin was blockaded there by Saladin, who, again according to William of Tyre, had 26,000 men. Accompanying Baldwin was Raynald of Chatillon, lord of Oultrejordain, who had just been released from captivity in Aleppo in 1176. Raynald was a fierce enemy of Saladin, and was the effective commander of the army, with King Baldwin too ill to command it personally. Also with the army were Odo de St Amand, master of the Knights Templar, Baldwin of Ibelin, his brother Balian, Reginald of Sidon, and Joscelin III of Edessa. Another Templar force attempted to meet Baldwin at Ascalon, but they were also besieged at Gaza.
Saladin continued his march towards Jerusalem, thinking that Baldwin would not dare to follow him with so few men. He attacked Ramla, Lydda and Arsuf, but because Baldwin was supposedly not a danger, he allowed his army to be spread out over a large area, pillaging and foraging. However, Baldwin and the Templars both escaped their blockades, and marched out along the coast, hoping to meet Saladin before he reached Jerusalem.
The combined force of Baldwin and the Templars amounted to Baldwin's knights, 80 Templars, and a few thousand infantry. They met Saladin at Montgisard near Ramla, surprising him completely, as his army was not prepared for a pitched battle. Saladin recalled his army as quickly as possible, organizing it into a centre flanked by two forward wings, one of which was commanded by his nephew Taqi ad-Din, but the cavalry had not rested since leaving Egypt and the horses were exhausted. While Saladin manoeuvered his flanks so that a nearby tell would be at their rear, the Christians attacked the centre line.
The Muslims were routed with heavy casualties, and their baggage was lost to the Christians. Taqi ad-Din's son, Ahmad, was killed in the fighting, and the jurist Diya ad-Din Isa was taken prisoner. Saladin himself escaped only because he rode a racing camel. The Old French translation of William of Tyre, commonly attributed to Ernoul, recorded that St. George took the field alongside Baldwin and Raynald.
Baldwin pursued Saladin until nightfall, and then retired to Ascalon. Deluged by ten days of heavy rains and suffering the loss of roughly ninety percent of his army, including his personal bodyguard of Mamluks, Saladin fled back to Egypt, harassed by Bedouins along the way. Only one tenth of his army made it back to Egypt with him.
Saladin, fearing the tenuousness of both his hold on Egypt and the alliance with his Syrian vassals, spread propaganda that the Christians had in fact lost the battle; Baldwin likewise propagandized his victory. He erected a Benedictine monastery on the battlefield, dedicated to St. Catherine of Alexandria, whose feast day fell on the day of the battle. However, it was a difficult victory; Roger des Moulins, master of the Knights Hospitaller, reported that 1100 men had been killed and 750 returned home wounded.
Meanwhile, Raymond III of Tripoli and Bohemund III of Antioch joined with Philip of Alsace in a separate expedition against Harim in Syria; the siege of Harim lasted into 1178, and Saladin's defeat at Montgisard prevented him from relieving his Syrian vassals. Despite an intervening year of relative peace, by 1179 Saladin was able to renew his attacks on the kingdom, leading to almost another decade of warfare which culminated in the Battle of Hattin in 1187.
An account of the battle is also given in Swedish author Jan Guillou's novel Tempelriddaren (The Knight Templar), in which the protagonist, Arn Magnusson (de Gothia) is portrayed as a high ranking member of the Knights Templar, commanding a contingent of the army at the battle of Montgisard.