CAIRO — Thousands of Egyptians celebrated the third anniversary of their revolt against autocracy on Saturday by holding a rally for the military leader who ousted the country’s first democratically elected president. Elsewhere, at least 49 people died in clashes with security forces at rival antigovernment protests organized by Islamists and left-leaning activists.

In at least on-e case, the Islamists and liberals chanted against each other. But within as little as 15 minutes, riot police officers began firing tear-gas cannons and shooting guns into the air, swiftly dispersing the protests and leaving the day to the military leader, Gen. Abdul-Fattah el-Sisi.

The violence escalated as the day went on. The Way of the Revolution Front, a group opposed to the Islamists as well as the military takeover, urged its supporters to retreat from the streets in the face of what it called “the excessive force that police are using against whoever tries to express their opinion.”

By Sunday morning, health officials said the death toll from clashes with the police had reached at least 49, most killed in the Cairo area. Security officials said more than 1,000 were arrested around the country. By Saturday night, more than 430 had been arrested in greater Cairo alone.