CAIRO — The prisoners were stripped and beaten, and their heads were shaved. They slept packed “like sardines” on concrete floors of cells infested with cockroaches. One said that an open wound on his arm was left oozing, that a cellmate suffered a heart attack without getting medical attention, and that another prisoner was 11 years old.

Such stories are unexceptional for Egyptian prisoners awaiting trial. But these were told by North Americans: a doctor and a filmmaker from Canada, Tarek Loubani and John Greyson, and a United States citizen, Mohamed Soltan, whose Egyptian father belongs to the Muslim Brotherhood. They were among at least seven Westerners caught up in the continuing crackdown on the Brotherhood and other opponents of the recent military takeover.

Smuggled letters from the three released over the weekend offer a rare outsiders’ perspective on longstanding Egyptian prison conditions, which rights advocates said remain unchanged after the successive ousters of President Hosni Mubarak in 2011 and President Mohamed Morsi three months ago. But the letters also illustrate a new willingness to subject Westerners to the same treatment that Egyptians receive, rights advocates said, even as the military-backed government that ousted the elected Islamists seeks to convince the West that it will build a modern democracy.

“It does create sort of an embarrassment for the government, but so far at least this government seems less concerned about its image with the West than the previous ones under Morsi or even Mubarak,” said Karim Ennarah, a researcher on the criminal justice system at the Egyptian Initiative for Personal Rights. “This is the normal Egyptian experience, but what is new is that foreigners used to seem to have some sort of protection from it.”