In an apparently separate case, a student who attended the Mashrou’ Leila concert was arrested hours later after being “caught in the act,” the police said. The student was charged with “debauchery” and sentenced to six years imprisonment on Tuesday.

The police lured the man to a location near the pyramids using a fake profile on a dating app, and arrested him.

Homosexuality is not illegal in Egypt, but the authorities frequently prosecute gay men for homosexuality and women for prostitution under loosely-worded laws that prohibit immorality and “habitual debauchery.”

Musical concerts are one of the few public gatherings still permitted to young Egyptians, who otherwise chafe under harsh restrictions introduced by Mr. Sisi that have outlawed public protest, led to prosecutions of writers and the censorship of films and music deemed critical of the government.

Mashrou’ Leila is a wildly popular band across the Middle East, with its exuberant brand of Arab indie rock. The band’s lead singer, Hamed Sinno, is one of the few openly gay celebrities in a Muslim country, and has spoken publicly about his orientation.

The band’s following grew after the Arab Spring, as it rode a wave of youthful openness, but it has since fallen foul of conservatives in different countries. It was twice banned in Jordan after facing accusations of blasphemy and not respecting the country’s traditions.

Egypt’s pro-government musicians union denounced last Friday’s concert, and said it was considering a ban on future performances by Mashrou’ Leila. In 2016 the syndicate drew sharp criticism for its effort to stop a heavy metal concert in Cairo that it claimed had been organized by “devil worshipers.”