President Edgar Lungu, who faces a stiff opposition challenge in the vote, had said after parliament was dissolved in May
Zambia's Constitutional Court ruled on Monday that all cabinet and provincial ministers should vacate their posts ahead of Aug. 11 elections as remaining in office would breach the law.
President Edgar Lungu, who faces a stiff opposition challenge in the vote, had said after parliament was dissolved in May that an amendment to the constitution allowed the ministers to remain in office until the election. The Constitutional Court ruled otherwise.
"It is unconstitutional for cabinet, provincial ministers and their deputies to continue occupying office after the dissolution of parliament on May 11," it said.
Lungu's ruling Patriotic Front party said it would abide by the court order.
"Today's decision ... gives credence to a robust and independent judiciary that Zambia has where the courts can enter judgements against the state," the PF said in a statement.
The opposition United Party for National Development said the ruling vindicated its position that the PF "has been abusing its position during the campaign period in a desperate attempt to hold onto power at any cost."
Zambia will hold presidential, parliamentary and local elections against the backdrop of slowing growth as Africa's second-biggest copper producer grapples with falling world demand.