An Egyptian writer has been jailed for two years after sexually explicit extracts from his novel were published in state media. A private citizen filed a case against author Ahmed Naji, claiming the passages caused him distress and heart palpitations.

Naji was initially acquitted, but was sentenced after an appeal from prosecutors.

Writers have defended Naji, claiming the verdict will stifle freedom of speech. Ibrahim Eissa accused Egyptian President Abdul Fattah al-Sisi of running a state no different from that of his deposed Islamist predecessor Mohammed Morsi.

"Your state and its agencies, just like those of your predecessor, hate intellectuals, thought and creativity and only like hypocrites, flatterers and composers of poems of support and flattery," Eissa wrote in the al-Maqal daily.

"Today's verdict is a travesty for freedom of expression and justice more broadly. It comes in the context of a broader crackdown which has brought us the detention of academics at airports, the harassment of cartoonists for their artwork, and the raiding of publishing houses," Mai El-Sadany, an expert on Egyptian law at the Robert F Kennedy Center for Human Rights in Washington DC told the Guardian.

Morsi was ousted by al-Sisi in a 2013 coup.

The editor of state-run literary review Akhbar al-Adab was fined after the extracts appeared in the paper. Naji will remain in custody while his lawyers prepare to appeal against the sentence.