Yahdun-Lim's daughter, while the rest of the Lim family took refuge in Yamhad, and the annexation was officially justified by what Shamshi-Adad considered sinful acts on the side of the Lim family. To strengthen his position against his new enemy Yamhad, Shamshi-Adad married Yasmah-Adad to Betlum, the daughter of Ishi-Addu of Qatna. However, Yasmah-Adad neglected his bride causing a crisis with Qatna, and he proved to be an unable leader causing the rage of his father who died in c. 1776 BC, while the armies of Yarim-Lim I of Yamhad were advancing in support of Zimri-Lim, the heir of the Lim dynasty. As Zimri-Lim advanced, a leader of the Banu-Simaal (Zimri-Lim's tribe) overthrew Yasmah-Adad, opening the road for Zimri-Lim who arrived a few months after Yasmah-Adad's escape, and married princess Shibtu the daughter of Yarim-Lim I a short time after his enthronement in c. 1776 BC. Zimri-Lim's ascension to the throne with the help of Yarim-Lim I affected Mari's status, Zimri-Lim referred to Yarim-Lim as his father, and the Yamhadite king was able to order Mari as the mediator between Yamhad's main deity Hadad and Zimri-Lim, who declared himself a servant of Hadad. Zimri-Lim started his reign with a campaign against the Banu-Yamina, he also established alliances with Eshnunna and Hammurabi of Babylon, and sent his armies to aid the Babylonians. The new king directed his expansion policy toward the north in the Upper Khabur region, which was named Idamaraz, where he subjugated the local petty kingdoms in the region such as Urkesh, and Talhayum, forcing them into vassalage. The expansion was met by the resistance of Qarni-Lim, the king of Andarig, whom Zimri-Lim defeated, securing the Mariote control over the region in c. 1771 BC, and the kingdom prospered as a trading center and entered a period of relative peace. Zimri-Lim's greatest heritage was the renovation of the Royal Palace, which was expanded greatly to contain 275 rooms, exquisite artifacts such as The Goddess of the Vase statue, and a royal archive that contained thousands of tablets. The relations with Babylon worsened with a dispute over the city of Hīt that consumed much time in negotiations, during which a war against Elam involved both kingdoms in c. 1765 BC. Finally, the kingdom was invaded by Hammurabi who defeated Zimri-Lim in battle in c. 1761 BC and ended the Lim dynasty, while Terqa became the capital of a rump state