Egypt's parliament approved the new Civil Service Law on Tuesday aimed at combating corruption and bureaucracy, having previously rejected the bill when it was proposed by President Abdel Fattah al-Sisi.
After making amendments, parliament passed the legislation, which was the only bill they rejected on its first submission by the president.
Lawmakers voted 401 to 26 in favour of the law, which regulates about 6.5 million state employees. Sisi has said Egypt could manage with just 1 million, an indication of his intention to prune back drastically.
Thousands of government workers protested against the law when it was first issued, saying it reduced their benefits and allowed officials to promote whoever they liked to high-ranking posts, as opposed to the current system based on seniority.
Members of parliament made changes to restore some of the benefits and to make it harder to sack staff, although not as hard as before the bill was put forward.
The law also introduces performance reviews, which could lead to job losses.
The law is part of a reform package the government is implementing in order to satisfy international funding bodies such as the International Monetary Fund.
The reforms include subsidy cuts, a new Value Added Tax system, and massive cuts to government staffing levels and associated costs.