CAIRO – The protests that toppled President Hosni Mubarak were driven in large part by hatred of the 30-year-old emergency law that gives the government broad powers to censor and detain citizens. But in a sign of the topsy-turvy world that Egyptians now live in, many here say they want the law to stay for the time being.

A broad swath of society — from glassworkers to accountants, Christians to Islamists — say the emergency law is one of the few things keeping them safe. Few dreamed they would ever say that; nor did they think they would see Mubarak detained in a hospital and his two sons thrown in jail, as happened last week.

“The emergency law is supposed to be there for unusual circumstances, and this is unusual,” said Maged Abdel Geill, 40, a driver who took deep drags of shisha while on a break at a Cairo cafe. “We’ve taken the emergency law for 30 years. One more year won’t make a difference.”

The law, which has been in place since President Anwar Sadat’s assassination in 1981, gives the government the right to arrest people without charges, then detain them indefinitely and to limit free speech and assembly. It was used to keep a lid on the Muslim Brotherhood and other opponents of Mubarak’s regime.

But the willingness to retain the law — which many interviewed said should end as soon as a new government is in place — is a symptom of a deeper problem.

“You get a feeling that there’s chaos,” said Tarek Fefaat, 45, an accounts manager, who also said he wanted the emergency law kept in place. Many police officers have withdrawn from the streets; tales of theft and violence sweep neighborhoods, and in Imbaba, an impoverished area of Cairo on the west bank of the Nile, some residents say they don’t dare walk the streets unarmed.

The change in attitudes about security has even extended, in some cases, to feelings about the much-feared police, who just two months ago were battling protesters in Tahrir Square while the Egyptian military stood on the side of change.

“The military is worse than the police. The police are getting better. But the military police, they’re vultures,” said Amr Abd el-Azim, 30, a boat pilot, who complained that last week a raid had put many of his fellow pilots in jail on what he said were false accusations of “thuggery.”

Now, many residents say, the few police who are on the streets are polite, even cautious. And the military has taken over the security functions of the country — something its soldiers aren’t trained to do.

“The military are doing basic policing right now,” said Heba Morayef, a researcher here for the New York-based Human Rights Watch, who said she thought the Emergency Law wasn’t necessary for the security forces to do their jobs. “They’re catching your basic thief.”

But instead of referring wrongdoers to civilian courts, Morayef said, many are being put through military justice.

“They see it as more efficient,” she said. “It is. You get a 15-minute session with a prosecutor, a group trial the same day, and you have court-appointed lawyers” whom the accused meet for the first time inside the courtroom.

There are no totally reliable counts of the number of people held in military detention, but rights groups here estimate that at least 5,000 people have been detained since the military took over the criminal justice system at the end of January.

Last week, a military court sentenced blogger Maikel Nabil, 25, to a three-year prison term for criticizing the government.

A few days after the sentence, the ruling Supreme Council of the Armed Forces announced it would review cases “of all young people who were tried during the last period.”

Many here questioned whether the improved behavior of the police was permanent, or if they were simply temporarily on the defensive. Others said that they had no choice but to shape up.

“Their only option is to try to be nice to people, so that they’ll be accepted,” said Dalia Youssef, a board member of People and Police for Egypt, a group that works to improve relations between civilians and the police force. She said she worried that older police officers would have trouble adjusting their habits and attitudes.

In a sign of how much tables have turned, one human rights group recently went to the police to initiate a complaint against a military officer.

“The police aren’t fond of the army anyway,” said Mona Saif, who works in a group called No to Military Trials of Civilians.

An army lieutenant illegally broke up a meeting that the group held last week in Imbaba, the Cairo neighborhood, Saif said. He arrested three of the people who were there.

So she went to the police to complain. “For the first time, the police were super friendly,” she said. “They also kept trying not to get involved,” for fear of starting a turf war, she said.

Before the revolution, she said, “We wouldn’t have filed a complaint against an army officer. I wouldn’t have needed to.”

Now, she said, “It is all new.”

Special correspondents Muhammad Mansour and Sherine Bayoumi contributed to this report.