Reuters reported that Qandil was a politically independent senior public servant in the Morsi administration, but was not popularly considered to be a likely candidate for the position of prime minister.[2] Qandil was Egypt's youngest prime minister since Gamal Abdel Nasser's appointment in 1954.[3] When Morsi was ousted in a coup d'état by the military in July 2013, Qandil after initially continuing in his role as prime minister until the formation of a new government, resigned his post on 8 July 2013 in protest of the subsequent bloodshed when 51 protesters were killed by the military at the Republican Guard headquarters.[4] He was arrested on 24 December 2013[5] and released seven months later on 15 July 2014[6] after he was acquitted by the Court of Cassation, which accepted his appeal and annulled the one-year sentence against him.[7][8]

After graduation, Qandil joined the Egyptian civil service in the water resources department in 1985. He was granted a presidential award in 1995 for services to irrigation, and was promoted to office director for the minister of water resources from 1999 to 2005.[11][3] He participated in the work of the Nile Basin Initiative, was an observer member of the Joint Egyptian-Sudanese Water Authority, and helped launch the African Water Council. He was also Chief of Water Resources at the African Development Bank, a position he held for approximately six years, from 2004 to early 2011. He returned to Egypt following the revolution to help rebuild the country. In 2011, he was appointed Minister of Water Resources and Irrigation as part of Prime Minister Essam Sharaf's second cabinet.[3]

On 6 January 2013, ten ministers in the first cabinet of Qandil were changed.[15] The reshuffle included ministry of finance, ministry of local development, ministry of transportation, ministry of legal affairs and parliamentary councils, ministry of electricity, ministry of interior, ministry of supply and social affairs, ministry of environment, ministry of communications and ministry of civil aviation.[15] Following the reshuffle, the number of the ministers who were the members of the Freedom and Justice Party increased to eight in the cabinet.[16][17]

On 1 July 2013, five cabinet members resigned together; they were Hisham Zazou, the tourism minister, Atef Helmi, the communications and IT minister, Hatem Bagato, the state minister for legal and parliamentary affairs, Abdel Qawi Khalifa, the irrigation minister, and Khaled Abdel Aal, the environment minister.[18]Mohamed Kamel Amr, the foreign minister, resigned as well.[19] The sports minister, El Amry Farouk, resigned on 2 July 2013.[20]

On 3 July 2013, an Egyptian appeals court upheld a verdict dismissing Qandil of his duties and sentenced him to one year in prison for not executing a court ruling to re-nationalize the Tanta Flax and Oil Company.[21] Subsequently, on the same day, a military coup unfolded deposing President Morsi from office and resulted in his detainment by the Egyptian army, along with other leading Muslim Brotherhood figures. On 8 July 2013, Prime Minister Qandil submitted his resignation effective immediately in protest of the subsequent bloodshed to the recent coup d'état when 51 protesters were killed by the military at the Republican Guard headquarters. He had initially decided to remain in his position as a caretaker PM until the formation of a new government.[4][22] In late September 2013, the Cairo Misdemeanor Court upheld the sentence against Qandil and he was arrested on 24 December 2013.[23][5] On 13 July 2014, the Court of Cassation accepted Qandil's appeal and abolished the verdict to imprison him for a year, to remove him from his job and to fine him 2,000 Egyptian pounds ($285).[7][8] He was subsequently released on 15 July 2014.[6]