After his release from jail, Azmi entered politics and in 1995, under his leadership, the SP won two seats in the Maharashtra state assembly. In 2004, entering his first election cycle, Azmi was defeated by Yogesh Patil of the Shiv Sena party (SSP) from Bhiwandi constituency. From 2002 - 2008, Azmi was the MP for Rajya Sabha. In the 2009 Lok Sabha election cycle, Azmi was defeated by Gurudas Kamat (Congress Party), Gajanan Kirtikar (SSP) and Shalani Thakrey (Maharashtra Navnirman Sena). However, in 2009, Azmi was elected to the Maharashtra Assembly where he served for two terms. He successfully contested the seats of Mankhurd-Shivaji Nagar and Bhiwandi (East), and under rules limiting successful candidates to one region, he chose Mankhurd-Shivaji Nagar.