Yahya Bey is known to have taken part during his youth in the Battle of Chaldiran of 23 August 1514 led by Sultan Selim I, also in the Ottoman–Mamluk War of 1516–17, and in Baghdad's expedition of 1535 under Sultan Suleiman. He earned the respect of powerful key people (between others the Sultan himself) because of his poetry. Yahya spent most of his early years in Ottoman campaigns, which inspired him. According to E. J. W. Gibb, he was inspired to write the "Yusuf and Züleyha" while in Palestine, on the road to Mecca. Egypt was also an inspiration for him, especially Cairo, which he called "the city of Joseph".