Egypt's justice minister resigned on Monday, the prime minister said in a statement, after being criticised for suggesting that the son of a garbage collector would be unworthy to serve as a judge.
The statement quoted Mahfouz Saber as saying his remarks in a televised interview a day earlier had been "a slip of the tongue". It was not immediately clear who would replace him.
Saber, who was appointed last June, said a judge "should have been brought up in a respectable financial and moral environment", while the son of a garbage collector would find "a suitable job".
Social inequality was one of the core grievances of the 2011 uprising that toppled veteran autocrat Hosni Mubarak and ultimately brought former army chief Abdel Fattah al-Sisi to the presidency.
Sisi, who promised widespread reforms and accountability after removing the Muslim Brotherhood from power in 2013 following mass protests, is still popular. But signs of discontent are slowly emerging.
Critics on social media condemned Saber's views as snobbish, racist and unconstitutional. "Yet another proof that justice in Egypt is just a farce," a Cairo blogger tweeted.
Egypt's judiciary has come under scrutiny in the past year over a series of cases including the sentencing to death of hundreds of alleged Muslim Brotherhood supporters and the trial of three Al Jazeera journalists.