Egypt’s armed forces have detained and tried thousands of people since taking control of the country this year, according to human rights and legal activists, who see it as a sign that the toppling of a president was just the start of Egyptians’ battle for democracy.

In the weeks that followed President Hosni Mubarak’s ouster Feb. 11, they say, the country’s security agencies have been weakened, but the military has continued many of its repressive practices and a hated emergency law that allows random arrests is still in place.

“We have another battle ahead with the army,” said Mona Seif, an activist with the Hisham Mubarak Law Center, a legal firm that works in the human rights field. “The army has a big part of it still loyal to the old regime. They have economic interests in the old system. They won’t let go of that easily.”

Last month, Seif said, she was demonstrating with her mother in central Cairo. Soldiers broke up the protest, and she watched as they hauled off a man and beat him. She confronted them, demanding his release. They let him go, his face bleeding. Later that day, she said, he was arrested again and sentenced in a three-minute military tribunal proceeding to five years in prison for assaulting an officer on duty and breaking curfew, despite being picked up hours before the curfew.

Seif began to look into the case and, with the help of lawyers at the center, learned that at least 5,000 people have been arrested and tried in military courts since Mubarak dismissed his government and sent the armed forces into the streets Jan. 28.

“Suddenly this case I witnessed opened a whole window into this awful world that no one knows about it and no one wants to talk about,” Seif said. “Everyone was talking about the military as our saviors.”

When the army was deployed in the face of growing anti-government protests in late January, people celebrated, chanting, “The army and the people are one.”

The feared police went underground during the uprising’s early days, but segments of the military began taking on their role. Soldiers beat up and detained demonstrators and charged them in military tribunals with carrying sticks or knives, breaking curfew or using Molotov cocktails, said activists, lawyers and released detainees. Sentences ranged from three months to life in prison. At least 25 minors are among those convicted, activists and lawyers said.

Far from shepherding Egypt to democracy, activists say, the military is governing according to decrees similar to those relied on by Mubarak.

Efforts have been mounted to help some people. The military has promised to review the case of Amr el-Behery, whose assault Seif witnessed, and that of Amr Essa, a well-known painter who was sentenced to three years on charges of assaulting an officer, carrying a weapon such as a knife or a stick and breaking curfew. But many poor and obscure people appear lost in a system with no viable appeals process or provision for public defense.

“The courts should only be used for soldiers, not citizens,” said Adel Ramadan, a lawyer with the Egyptian Initiative for Personal Rights. “The military supreme court prefers to ensure security at the expense of justice.”

This week, Ragi Muhammed el-Kashef, 24, went to visit his brother in prison. The two had been detained on the afternoon of March 9, when thugs attacked protesters in Cairo’s Tahrir Square, the heart of the revolt. Soldiers dismantled the tents they had been sleeping in and arrested at least 170 people, including the brothers.

The soldiers dragged them to an open area between the burned headquarters of Mubarak’s National Democratic Party headquarters and the Egyptian Museum. They blindfolded them, bound their arms, beat them with sticks and electric cables, and prodded them with electric rods, the young filmmaker said.

“I expected this to happen from thugs, not from the military,” he said. “I felt our revolution was done, finished, dead.”

That night, they were taken to a parking lot outside a military base. Kashef was interrogated, and the next day they were split into groups and tried before a judge, with military lawyers defending them. The proceedings were held in a kitchen as soldiers prepared meals. In half an hour it was over. They were not allowed to contact their families. Three days later, he was freed, along 20 others, but his 22-year-old brother, Raef, was sentenced to a year in prison.

During the visit, Kashef said, Raef looked at him and asked: “Are we wrong? Should we stop?”

“No, we are not wrong,” he said he told his brother. “You are here because we are right.”

On Friday, Kashef went back to Tahrir Square, where, despite a ban on gatherings, tens of thousands of people had turned out to demand the trial of corrupt officials from Mubarak’s regime, the disbarment of the National Democratic Party and a civilian council with a military representative to rule Egypt during the transition to an elected government.

“I’m worried about Egypt’s future,” he said. “The people and the army are not one hand. We are not soldiers to be ruled over by military officers.”

Special correspondent Haitham Tabei contributed to this report.