Ibn Khaldūn took his judicial duties quite seriously; he claimed to have been guided in his judgments solely by the merits of each case and attempted to reform the numerous abuses that had developed in the administration of justice. He must have struck the tolerant and easygoing Egyptians as somewhat dour and puritanical, and his own opinion is recorded by one of his students: “These Egyptians behave as though the Day of Judgement would never come!” At any rate, “trouble gathered against me from every quarter and darkened the atmosphere between me and the rulers”; he was dismissed and served again as chief judge only for one year, toward the end of his life. But he was given another professorship—he pointed out that endowed chairs were plentiful in Cairo—and spent his time teaching, writing, and revising his Muqaddimah. He was also able to perform the pilgrimage to Mecca, sailing from Al-Ṭawr, near Suez, and returning by way of Upper Egypt. Some years later he went to Damascus and the holy cities of Palestine, thus further widening his knowledge of the eastern Arab world. It is interesting to note that he visited the tomb of Abraham in Hebron and the Church of the Nativity in Bethlehem, both Abraham and Jesus being honoured prophets, but he refused to enter the Holy Sepulchre, “the site of what they claim to be the Crucifixion,” an event that Muslims deny occurred.
Ibn Khaldūn was forced to play a minor part in the palace revolt of 1389, but he apparently did so under duress, and Barqūq seems to have borne him no grudge. Otherwise, one gets the impression of a ripe, wise, and respected scholar, surrounded by admirers, sought out by visitors, peacefully enjoying the calm pleasures of old age. He had every reason to expect this state of affairs to continue, but fate had reserved for him one more encounter, the most dramatic of all.