CAIRO — Egypt’s president praised the country’s policemen on Friday despite public criticism over their violent response to anti-government demonstrations, and warned officers who are also protesting his rule against breaking ranks.

President Mohammed Morsi spoke ahead of traditional Islamic Friday prayers, which he attended at a Cairo-based camp for riot police in a show of solidarity with the force. The black-clad riot squads have been at the forefront of deadly clashes with protesters for more than two years.

Rights groups accuse the police of using snipers and lethal force against unarmed protesters. More than 1,000 demonstrators have died in the clashes, and policemen also have been killed and have suffered serious injuries.

Part of the Interior Ministry’s force that oversees Egypt’s battered police has been on strike for more than a week. Many say they are tired of having to confront protesters angry with Morsi and his Muslim Brotherhood group’s policies.

They are demanding that Interior Minister Mohammed Ibrahim resign and accuse him of trying to politicize the force. Thousands of policemen in the Interior Ministry are also demanding higher wages, better working conditions, greater firepower and stronger immunity from prosecution for carrying out their duties.

Some of the striking officers say the Brotherhood is attempting to control them. The Brotherhood denies that.

In his speech, Morsi warned the force against divisions.

“Be aware, as I know you are, against breaking ranks or else our enemy will break us all,” Morsi said. “Our enemy outside the country is happy when we are divided.”

The head of riot police and the interior minister stood next to Morsi as he told dozens of low-ranking policemen — who mostly hail from Egypt’s poorest quarters — that their unity and hard work is appreciated.

“This country loves you, hugs you and protects you, and always expects from you courage and sacrifice,” Morsi said.

His praise of the police comes as a government report obtained this week by The Associated Press concluded that police were behind the deaths of nearly 900 protesters during the country’s 2011 uprising.

For decades, the police in Egypt also targeted Islamists. Morsi himself was in prison during the start of the country’s 2011 uprising against longtime authoritarian ruler Hosni Mubarak. Police brutality was rampant under Mubarak and the uprising was largely fueled by hatred of the force.

Rights activists on Facebook denounced Morsi’s speech and questioned his suggestion that police were at the heart of the uprising.

“Instead of this talk that turns the facts upside down in an attempt to reach out to riot police, should it not be a priority first of the president to put forth a plan to repair the relationship between police and the people?” asked one group dedicated to the case of Khaled Said, a young man tortured to death by police in 2010.

The death became a rallying cry for protesters that in part led to the uprising that toppled Mubarak.

Morsi acknowledged changes that have swept Egypt since then, saying that his June 30 election as the country’s first freely elected and first civilian president was a historical turning point for the police force.

In the past two years, around 100 policemen have been tried in cases related to the killing of protesters with almost all ending in acquittals.

Reform of the police is among protesters’ top demands.

In the restive Suez Canal city of Port Said, thousands of residents rallied against Morsi on Friday. They also demanded retribution for the killing of around 45 people in clashes with police there this year.

The protest came a day after Morsi delivered a televised message to the people of Port Said, promising investigations that would uncover perpetrators of the recent unrest there.

Last week, protesters in the city torched security headquarters there, forcing the police to withdraw from the streets. The army, which took over security of the city, was enthusiastically welcomed.

That sentiment was echoed in Cairo, where several hundred people rallied on Friday in support of bringing back military rule and ousting Morsi.