He is a member of the All India Trinamool Congress party. Hakim was elected to the West Bengal Legislative Assembly in 2009. Two years later, he became a cabinet minister in the Mamata Banerjee ministry. In December 2018, he was elected mayor following the resignation of the incumbent Sovan Chatterjee. He is the first Muslim since the independence of India to become the mayor of that city. They live in Chetla, a neighborhood of South Kolkata.