The Egyptian military has secretly detained hundreds and possibly thousands of suspected government opponents since mass protests against President Hosni Mubarak began, and at least some of these detainees have been tortured, according to testimony gathered by the Guardian.

The military has claimed to be neutral, merely keeping anti-Mubarak protesters and loyalists apart. But human rights campaigners say this is clearly no longer the case, accusing the army of involvement in both disappearances and torture – abuses Egyptians have for years associated with the notorious state security intelligence (SSI) but not the army.

The Guardian has spoken to detainees who say they have suffered extensive beatings and other abuses at the hands of the military in what appears to be an organised campaign of intimidation. Human rights groups have documented the use of electric shocks on some of those held by the army.

Egyptian human rights groups say families are desperately searching for missing relatives who have disappeared into army custody. Some of the detainees have been held inside the renowned Museum of Egyptian Antiquities on the edge of Tahrir Square. Those released have given graphic accounts of physical abuse by soldiers who accused them of acting for foreign powers, including Hamas and Israel.

Among those detained have been human rights activists, lawyers and journalists, but most have been released. However, Hossam Bahgat, director of the Egyptian Initiative for Personal Rights in Cairo, said hundreds, and possibly thousands, of ordinary people had "disappeared" into military custody across the country for no more than carrying a political flyer, attending the demonstrations or even the way they look. Many were still missing.

"Their range is very wide, from people who were at the protests or detained for breaking curfew to those who talked back at an army officer or were handed over to the army for looking suspicious or for looking like foreigners even if they were not," he said. "It's unusual and to the best of our knowledge it's also unprecedented for the army to be doing this."

One of those detained by the army was a 23-year-old man who would only give his first name, Ashraf, for fear of again being arrested. He was detained last Friday on the edge of Tahrir Square carrying a box of medical supplies intended for one of the makeshift clinics treating protesters attacked by pro-Mubarak forces.

"I was on a sidestreet and a soldier stopped me and asked me where I was going. I told him and he accused me of working for foreign enemies and other soldiers rushed over and they all started hitting me with their guns," he said.

Ashraf was hauled off to a makeshift army post where his hands were bound behind his back and he was beaten some more before being moved to an area under military control at the back of the museum.

"They put me in a room. An officer came and asked me who was paying me to be against the government. When I said I wanted a better government he hit me across the head and I fell to the floor. Then soldiers started kicking me. One of them kept kicking me between my legs," he said.

"They got a bayonet and threatened to rape me with it. Then they waved it between my legs. They said I could die there or I could disappear into prison and no one would ever know. The torture was painful but the idea of disappearing in a military prison was really frightening."

Ashraf said the beatings continued on and off for several hours until he was put in a room with about a dozen other men, all of whom had been severely tortured. He was let go after about 18 hours with a warning not to return to Tahrir Square.

Others have not been so lucky. Heba Morayef, a Human Rights Watch researcher in Cairo, said: "A lot of families are calling us and saying: 'I can't find my son, he's disappeared.' I think what's happening is that they're being arrested by the military."

Among those missing is Kareem Amer, a prominent government critic and blogger only recently released after serving a four-year prison sentence for criticising the regime. He was picked up on Monday evening at a military checkpoint late at night as he was leaving Tahrir Square.

Bahgat said the pattern of accounts from those released showed the military had been conducting a campaign to break the protests. "Some people, especially the activists, say they were interrogated about any possible links to political organisations or any outside forces. For the ordinary protesters, they get slapped around and asked: 'Why are you in Tahrir?' It seems to serve as an interrogation operation and an intimidation and deterrence."

The military has claimed to be neutral in the political standoff and both Mubarak and his prime minister, Ahmed Shafiq, have said there will be no "security pursuit" of anti-government activists. But Morayef says this is clearly not the case.

"I think it's become pretty obvious by now that the military is not a neutral party. The military doesn't want and doesn't believe in the protests and this is even at the lower level, based on the interrogations," she said.

Human Rights Watch says it has documented 119 arrests of civilians by the military but believes there are many more. Bahgat said it was impossible to know how many people had been detained because the army is not acknowledging the arrests. But he believes that the pattern of disappearances seen in Cairo is replicated across the country.

"Detentions either go completely unreported or they are unable to inform their family members or any lawyer of their detention so they are much more difficult to assist or look for," he said. "Those held by the military police are not receiving any due process either because they are unaccounted for and they are unable to inform anyone of their detention."

Human Rights Watch has also documented detentions including an unnamed democracy activist who described being stopped by a soldier who insisted on searching his bag, where he found a pro-democracy flyer.

"They started beating me up in the street their rubber batons and an electric Taser gun, shocking me," the activist said.

"Then they took me to Abdin police station. By the time I arrived, the soldiers and officers there had been informed that a 'spy' was coming, and so when I arrived they gave me a 'welcome beating' that lasted some 30 minutes."

While pro-government protesters have also been detained by the army during clashes in Tahrir Square, it is believed that they have been handed on to police and then released, rather than being held and tortured.

The detainee was held in a cell until an interrogator arrived, ordered him to undress and attached cables from an "electric shock machine".

"He shocked me all over my body, leaving no place untouched. It wasn't a real interrogation; he didn't ask that many questions. He tortured me twice like this on Friday, and one more time on Saturday," he said.