Karamanid was a Turkmen state in central Anatolia after the disintegration of Seljuq Sultanate of Rûm. The capital of Karamanid state was usually Karaman (ancient Larende, renamed by the Karamanids) and sometimes Konya and other cities as well. It was the main rival of the rising Ottoman Empire.
Ali was the younger brother of Mehmed II of Karaman. In 1398, Bayezid I of the Ottoman Empire conquered the Karamanid state and jailed Mehmed and Ali. But in 1402, Bayezid himself was defeated by Timur in the battle of Ankara and the two brothers were set free with a permission from Timur to reign on former Karamanid territory. Timur also gave them a few forts in addition to their former possessions. While Mehmed acquired most of Karamanid territory, Ali had to deal with Niğde, a city at the east of Karamanid territory. Although Ali was a vassal of his brother, soon he began acting independently. But he was no match for his brother and in 1415 he escaped to Mamluk Sultanate in Egypt.
In 1420 Mehmed tried to capture the city of Kayseri from the Dulkadirids, which was a vassal of Mamluk Sultanate. Mamluks intervened and Mehmed was defeated. Mamluks arrested Mehmed and supported Ali to gain the possessions of his brother. Ali began reigning on the Karamanid territory with the exception of Konya, the most important city of Karamanids. However Ali's reign was short. Because in 1421 Mehmed was released by the new Mamluk sultan Seyfettin Tatar. Mehmed returned to Anatolia and conquered his former possessions. Ali returned to Niğde.
In 1423 Mehmed died during the siege of Antalya. This gave Ali a second chance to reign. The second reign was also short. Mehmed's son Ibrahim who was supported by the Ottomans defeated his uncle in 1424. However İbrahim chose to make peace with his uncle by giving him extra possession as iqta in addition to Niğde.
| Bey of Karaman