Siege of Baghdad (1157)
The siege of Baghdad in 1157 was the last Seljuq attempt to capture Baghdad from the Abbasids. Caliph al-Muqtafi successfully defended his capital against the coalition armies of Seljuq Sultan Muhammad of Hamadan and Qutb ad-Din of Mosul.
The siege of Baghdad in 1157 was the last Seljuq attempt to capture Baghdad from the Abbasids. Caliph al-Muqtafi successfully defended his capital against the coalition armies of Seljuq Sultan Muhammad of Hamadan and Qutb ad-Din of Mosul.

Background
In the tenth century the Abbasid Caliphate lost control of most of its former provinces. Most of the governors were able to establish their own dynasties, and in the meantime the central government was unable to stop independence movements within the empire, though they retained their spiritual leadership over the Muslims since the new states (the Tulunids/Ikhshidids, Hamdanids, and others) acknowledged the later Abbasid Caliphs as the head of the state and the successor of the prophet. In 1055, Tughril captured Baghdad from the Buyids under a commission from the Abbasid Caliph al-Qa'im. 
Al-Mustarshid (r. 1118–1135) ruled for sixteen years as Caliph but the last three years of his reign were occupied with war against Seljuq sultan Mas'ud (his deputy).
Not long after the siege of Damascus, al-Mustarshid launched a military campaign against Seljuk sultan Mas'ud, who had obtained the title in Baghdad in January 1133 by the caliph himself. The rival armies met near Hamadan.  The caliph, deserted by his troops, was taken prisoner, and pardoned on the promising not to quit his palace. Left in the caliphal tent, however, in the sultan's absence, he was found murdered while reading the Quran, as is supposed, by an emissary of the Assassins, who had no love for the caliph.  Modern historians have suspected that Mas'ud instigated the murder although the two most important historians of the period Ibn al-Athir and Ibn al-Jawzi did not speculate on this matter. Physically, al-Mustarshid was a red-haired man with blue eyes and freckles.
To avenge his father's death, the new Caliph Al-Rashid Billah insulted the envoy of sultan Ghiyath ad-Din Mas'ud. 
The Siege of Baghdad was a fifty-day blockade of Baghdad, the seat of the Abbasid Caliphate, in 1136. The siege began when the Seljuk ruler of Iraq, Ghiyath ad-Din Mas'ud, attacked the caliph al-Rashid Billah. During the siege, the populace of Baghdad rose in revolt against the caliph, plundering the Tāhirid palace. In the end, al-Rashid fled the city for Mosul, where he abdicated the caliphate. His uncle, al-Muqtafi, was raised to the throne instead, Al-Rashid Billah then retired to the east.

The siege
Muhammad marched to Baghdad with an army of 30,000 men, while his ally Qutb ad-Din marched from Mosul to capture the Caliphate's provinces in central Iraq. On January 12, 1157, Muhammad reached the walls of western Baghdad. In response the Caliph gathered all his troops from Hillah and Wasit to defend the capital. In February, unable to defend western Baghdad, the caliph abandoned the western side and ordered all the bridges over the Tigris river, which separates the western side of Baghdad from its eastern side, to be destroyed. Muhammad crossed to the western side and easily captured it, and established his camp while at the same time the caliph fortified the walls of eastern Baghdad. Several catapults and ballistas were installed on the city's walls. The caliph also armed the natives of Baghdad by giving them armour and weapons, and incited them to fight the enemy of the caliphate, whom he called infidels since they waged war against the caliph, the successor of the prophet and the leader of the ummah. He also ordered his vizier Awn ad-Din ibn Hubayra to give five golden dinars to every wounded soldier.
On March 4, Sultan Muhammad and his ally Zayn ad-Din, Qutb ad-Din's vizier, attacked eastern Baghdad and bombarded the city. The army of Baghdad repulsed the attack thanks to the courage of the  natives of Baghdad and the naffatuns.

The end of the siege
On March 29, the Seljuqs repaired one of the bridges and crossed to the eastern side of the city, where they skirmished with both the Caliph's army and the native militias of Baghdad. The naffatuns destroyed several catapults. The Seljuqs tried to breach the gate by a battering ram but it was destroyed by the catapults on the walls. The result of the battle remained indecisive for both sides. On June 29, Sultan Muhammad ordered his men to climb the walls. He had already made 400 ladders to climb the walls of Baghdad, but the assault was repulsed due to the heavy fire and casualties. In the meantime Nur ad-Din Zangi blamed his brother for attacking the caliph's realm, which destroyed the Zengid-Seljuq alliance. Zayn ad-Din lifted the siege and returned to Mosul.
Muhammad also was forced to lift the siege after his men informed him that his brother Malik Shah has captured Hamadan. He eventually realized that the siege was useless, so he preferred to fight for his throne. Thus the Siege of Baghdad came to end on 13 July 1157.

See also
Siege of Baghdad (1136)
Siege of Baghdad (1258)

References
Source
Le Strange, Guy (1922). Baghdad During the Abbasid Caliphate. From Contemporary Arabic and Persian Sources (Second ed.). Oxford: Clarendon Press.