The battle of Babain (18 March 1167) was an inconclusive battle during Nur ad-Din's second invasion of Egypt that is best know for being Saladin's first recorded major battle.
In 1164 Nur ad-Din, then ruler of much of Syria, had sent an army to Egypt to restore the vizier Shawar. At the time Egypt was ruled by the Shi'a Fatimid caliphs, while Nur ad-Din was loyal to the Sunni caliphs of Baghdad, but at least as the start of the 1164 campaign he was willing to work within the Fatimid system. A Syria army, commanded by Saladin's uncle Shirkuh, entered Egypt and restored Shawar. The vizier then refused to pay the tribute he had promised and called on King Amalric of Jerusalem for aid. Shirkuh was besieged in Bilbais, but events elsewhere convinced Amalric to accept a peaceful end to the siege. Both the Franks and the Syrians returned home and Shawar remained in power in Egypt.
Shirkuh spent the next few years attempting to convince Nur ad-Din to overthrow the Fatimids. Eventually Nur ad-Din was convinced and in 1167 Shirkuh (accompanied by Saladin) was given a new army and sent into Egypt, this time with the sole mission of overthrowing the Fatimids. The Syrian army crossed Sinai on a route designed to take them away from the Franks, but they did run into a sandstorm which inflicted some casualties.
Once again King Amalric and the Franks of Jerusalem came to the aid of Shawar. Shirkuh was probably outnumbered, and he responded by crossing to the west bank of the Nile, and camping at Giza, opposite Cairo. The campaign then stalled as both sides decided if it was worth fighting, but eventually the Franks and the Egyptians crossed to the west bank of the Nile. Shirkuh retreated south, eventually reaching Babain, where he finally decided to stand and fight.
Shirkuh came up with a simple plan to negate the main strength of the Crusader army, their heavy cavalry charge. He positioned Saladin in the centre of the line, with orders to carry out a feigned retreat when the Crusaders charged. The Franks would follow and would be pulled out of the battle.
The plan worked. Amalric charged the Syrian centre and Saladin pulled back. The Franks followed, leaving Shirkuh to deal with the rest of the Egyptian army. By the time Amalric returned the situation was apparently somewhat confused, with small fights taking place in a number of valleys on the edge of the desert. Amalric was able to withdraw having lost around 100 men.
The sources generally describe this as a victory for Shirkuh. He had won control of the battlefield, but he didn’t feel strong enough to risk an attack on Cairo, so instead he moved to Alexandria, where the city had rebelled against the Fatimids. Amalric and the Egyptians followed, and Saladin was soon besieged in Alexandria, in what became his first major command.