An Egyptian court on Tuesday overturned a government decree allowing the army to arrest civilians, a setback for military rulers preparing to hand power to an elected president.
The army-backed interim government issued the decree days before a tense presidential run-off vote on June 16-17 to give soldiers the power to detain people during street disturbances.
But rights groups and politicians challenged the decision, accusing the military of reviving emergency powers that stymied opposition to Hosni Mubarak until a popular uprising ended his three-decade rule in February last year.
On Tuesday, a court agreed with them.
"The court declares in its ruling that the Minister of Justice raped the authority bestowed by the constitution by issuing a decision to give members of the military police and military intelligence powers of arrest," a document from the Cairo court explaining Judge Ali Fikry's ruling read.
The Justice Ministry has the right to appeal the administrative court's ruling, which is effective immediately.
The original decree restored the military's mandate to enforce law and order before a new constitution is written - a process expected to last well beyond the July 1 date by which the ruling military council is due to hand power to president-elect Mohamed Mursi of the Muslim Brotherhood.
The army has already curbed Mursi's power by dismissing parliament and assuming greater control over the drafting of the new constitution. His authority remains subject to back-room negotiations with the Supreme Council of the Armed Forces.
"This ruling not only adheres to the constitution," said Gamal Eid, a lawyer and rights activist. "It chimes with the current political climate because many people feel the military council is trying to suppress the civil direction in which the state is supposed to be heading."
The Mubarak-era state of emergency was ostensibly invoked to deal with terrorism and drug offences, but gave the security forces sweeping powers of search and arrest, leaving citizens with little protection from police who chose to abuse that mandate.
The military generals who took power when Mubarak stepped aside vowed to scrap the emergency law but then kept it in place for most of their rule, using it to arrest thousands of civilians and subject them to military trials.
During Mubarak's time, the law was used repeatedly to arrest members of the Brotherhood, his long-time adversary.
One of those was Mursi, who triumphed over Mubarak's last prime minister Ahmed Shafik in this month's run-off vote, sealing the Islamist movement's dramatic rise from political isolation to the heart of power.