Egypt's Justice Minister Mahfouz Saber, who stirred protests with remarks that becoming a judge was too lofty an ambition for the sons of cleaners, has resigned, the premier announced Monday.
Prime Minister Ibrahim Mahlab said he accepted the resignation, two days after the controversial remarks made in a television interview.
Judges are "lofty and have status", and must come from "a respectable milieu", Saber said. If a son of a cleaner were to work as a judge, "he would get depressed and won't continue".
Mahlab, quoted by state news agency MENA, said: "The government respects all sectors of society, especially the labourers and artisans who contribute to building the future of the country."
The justice minister chose to resign "out of respect for public opinion" and regretted the way he had expressed himself, according to the premier, who was speaking from a visit to Paris.
Signup to our newsletter and follow us on Facebook and Twitter!
Critics swiftly took to Twitter after the justice minister's interview was aired to call for the minister to be sacked.
"The son of a cleaner can't work in the judiciary. But he can die in Sinai defending you," wrote one user, referring to a military campaign against an Islamist insurgency in the peninsula.
Mohamed ElBaradei, a former vice president, pointed out that international rights charters guarantee freedom of choice of employment.
"When the sense of justice abandons a country, nothing is left," he tweeted.
Saber's remarks were not the first from the judiciary to cause controversy in a country where government figures show at least 26 percent of the population lives below the poverty line.
Last year, 138 prosecution service applicants were turned down because their fathers had not obtained university degrees.
The Egyptian constitution prohibits discrimination based on class or gender.