Kayani's tenure was marked by a peaceful transfer of power from one civilian government to another, a first for a country that has been dominated by a powerful military for most of its history.
The general was credited with publicly staying out of politics although the army continued to play a powerful role in the background, especially with regard to policy toward the Afghan war, U.S. relations and relations with Pakistan's neighbor and archenemy, India.
Relations with the U.S. were severely tested by several episodes during Kayani's tenure including the covert American raid that killed Osama bin Laden near Pakistan's equivalent of West Point in 2011.
Kayani and other officials were outraged by the operation because they were not told about it beforehand and curtailed military and intelligence cooperation with the U.S.
American officials expressed disbelief that Pakistan didn't know the al-Qaida chief was hiding in the town of Abbottabad. The U.S. never uncovered evidence indicating Kayani or other senior officials knew bin Laden's whereabouts, but suspicions about Pakistan's loyalties remained.
During his tenure, Pakistan also launched numerous operations against militants in the tribal areas that have been waging war against the Pakistani state. Those operations sparked fierce retaliation by the militants against both civilian and military targets, and thousands of troops have been killed and wounded.
Despite the army's efforts, however, violence has continued. Dealing with the insurgency will be a key task for the country's next army chief, who will be appointed by Prime Minister Nawaz Sharif.
The appointment will be a challenge for Sharif, who has had a rocky relationship with the military. He was deposed as prime minister in 1999 by Gen. Pervez Musharraf, the man that Kayani succeeded as army chief in 2007.
The new army chief will also face an uprising by separatists in Pakistan's southwestern Baluchistan province as well as heightened tensions along the de-facto border that separates the Pakistani- and Indian-held sides of the disputed region of Kashmir.