Ali Pasha then went on the Hajj (pilgrimage) to Mecca, and there, he was allegedly discovered to be engaging in sexual intercourse with a young boy that he had kidnapped from Tripoli, after which many of the pilgrims attacked him, cut off his beard, and nearly killed him. After the Hajj, Ali Pasha returned to Egypt and stayed as Murad Bey's guest for several years until the arrival of the French in 1798. He fought with the Mamluk emirs against the French and escaped with them to southern Egypt during the French rule. He then returned to Constantinople, the Ottoman capital.