In June 2012, with the backing of the Muslim Brotherhood, Mohammed Morsi won a narrow victory over a representative of the country's former regime.