CAIRO — A video showing a mass sexual assault on a nearly naked woman in the midst of inaugural celebrations for Egypt’s new president is testing his pledge to curb an epidemic of such attacks, with captured scenes of a police officer with a gun in his hand struggling against a crowd of men to extricate the victim.

At first a black shirt covered just her shoulders, her backside purple and black with bruises. Moments later, she is seen stripped completely, as her limp and reddened body is carried into a waiting vehicle.

Captured in a blurry two-minute video taken in Tahrir Square on Sunday and circulated via YouTube on Monday, the attack is forcing the new president, Abdel Fattah el-Sisi, to confront a phenomenon many here said resulted from the collapse of the police force during the uprising against Hosni Mubarak in 2011: the recurring mass sexual assaults that have taken place amid the crowds that have gathered in Tahrir Square ever since.

“This is a threat to our security,” said Ghada Shahbander, a human rights advocate. “What are you going to do about it?”