For six years, he studied theology with Peter Lombard and Maurice de Sully. Afterwards, he studied civil law and canon law in Bologna, with the "Four Doctors", Hugo de Porta Ravennate, Bulgarus, Martinus Gosia, and Jacobus de Boragine. William's list of professors "gives us almost a who's who of the grammarians, philosophers, theologians, and law teachers of the so-called Twelfth-Century Renaissance", and shows that he was as well-educated as any European cleric. His contemporary John of Salisbury had many of the same teachers. The highest religious and political offices in Jerusalem were usually held by Europeans who had arrived on pilgrimage or crusade. William was one of the few natives with a European education, and he quickly rose through the ranks. After his return to the Holy Land in 1165, he became canon of the cathedral at Acre. In 1167 he was appointed archdeacon of the cathedral of Tyre by Frederick de la Roche, archbishop of Tyre, with the support of King Amalric. Amalric had come to power in 1164 and had made it his goal to conquer Egypt. Egypt had been invaded by King Baldwin I fifty years earlier, and the weak Fatimid Caliphate was forced to pay yearly tribute to Jerusalem. Amalric turned towards Egypt because Muslim territory to the east of Jerusalem had fallen under the control of the powerful Zengid sultan Nur ad-Din. Nur ad-Din had taken control of Damascus in 1154, six years after the disastrous siege of Damascus by the Second Crusade in 1148. Jerusalem could now expand only to the southwest, towards Egypt, and in 1153 Ascalon, the last Fatimid outpost in Palestine, fell to the crusaders. Nur ad-Din, however, also wished to acquire Egypt, and sent his army to hinder Amalric's plans. This was the situation in the east when William returned from Europe. In 1167 Amalric married Maria Comnena, grand-niece of Byzantine emperor Manuel I Comnenus, and in 1168 the king sent William to finalize a treaty for a joint Byzantine-crusader campaign against Egypt. The expedition, Amalric's fourth, was the first with support from the Byzantine navy. Amalric, however, did not wait for the fleet to arrive. He managed to capture Damietta, but within a few years he was expelled from Egypt by one of Nur ad-Din's generals, Saladin, who would later become Jerusalem's greatest threat.