Under Psusennes II (21st Dynasty), a local ruler from Herakleopolis of Libyan descent, Shoshenq, managed to acquire substantial influence over the government. He later became the first king of the 22nd Dynasty. During this period, the residence was usually the town of Tanis in the Delta, and to some extent also Memphis. Bubastis also played an important role, sometimes as residence or, as is usually assumed nowadays, as the place whence the kings of this dynasty originally came; a great deal of building work was undertaken in Bubastis in this period. Kings from both the 21st and the 22nd Dynasties were buried within the temple precinct at Tanis. All three of the towns were under the direct control of the kings, but other cities in Lower Egypt were ruled by Libyan princes, thus dividing control over Egypt. Shoshenq appointed one of his sons as High Priest in Thebes (which also gave him military power) and married his son Osorkon to Hatshepsut, a royal princess of the 21st Dynasty. Shoshenq (called Shishak in the Bible) undertook a military campaign to Palestine to conquer both Israel and Judea. The victories are recorded on the walls of the temple of Karnak. The period which followed was politically chaotic. Various different people succeeded to the Egyptian throne, including the High Priest Harsiese in Thebes, Takelot II and Shoshenq III. The position of High Priest also changed hands frequently. Under Shoshenq III's successor, the royal house split in two with one half ruling from Bubastis (the 22nd Dynasty proper) and the 23rd Dynasty. To begin with, both dynasties ruled together over the land of Egypt, but gradually conflicts broke out, and eventually the 22nd Dynasty only continued to hold sway over Bubastis and Memphis, and the 23rd Dynasty over other places in the Delta, Middle Egypt and the God's State of Amun in Thebes. Eventually, Osorkon IV, the last king of the 22nd Dynasty, would be banished by the Libyan prince Tefnakht (24th Dynasty).