An Egyptian lawyer has challenged the constitutionality of a law that allows writers to be sent to jail for violating public morals.

Nasser Amin made the motion in court Saturday during the trial of writer Ahmed Naji, who is facing charges for work that was published in a literary magazine that prosecutors say is sexually explicit.

Naji faces up to two years in jail and a fine up to 10,000 Egyptian pounds ($1,245) if found guilty.

Naji said the issue began when Akhbar al-Adab magazine published an excerpt from his novel "The Use of Life" in August 2014. It contains explicit sex acts and references to habitual hashish use by the characters.

Amin served as an alternate member of the committee that drafted Egypt's current constitution.