After leaving office, Fahmi was investigated because of alleged wrongdoing. In April 2011, it was announced by the public prosecutor that he would be tried in relation to the charges related to a natural gas deal with Israel. He was arrested and held in custody on 21 April 2011. Fahmi was sentenced to 15 years in prison in June 2012 due to his alleged role in selling and exporting natural gas to Israel in 2005 at lower prices than market rates. He along with other officials was also fined about $2.3 billion.
In mid-March 2013, the court of cassation decided that Fahmi should be retried over the Egypt-Israel gas case. On 28 March 2013, he was released from prison since he stayed in prison longer than the maximum 18 months allowed for pre-trial detention. Specifically, he was jailed for 23 months.