TEHRAN — They came to celebrate the short life of Ali Reza Moshajjari, a local boy from a south Tehran neighborhood and apparently the latest Iranian victim of the escalating sectarian conflict in neighboring Iraq and in Syria.

He was a member of Tehran’s 209 Battalion of the Imam Ali garrison of the Islamic Revolutionary Guards Corps, the Iranian news media said, and representatives of elite units of the corps stood solemnly in a line, as men clad in black entered the mosque.

As the service got underway on Tuesday, a chanter’s voice boomed through the mosque, echoing in the lofty dome, lined with blue and green tiles. “Our godless enemies behead our soldiers,” he said. From the women’s quarters, behind a panel segregating them from the men, a loud wailing commenced. Men shook their heads, and some clenched their fists.

“Our youth was a special martyr,” the chanter said of Mr. Moshajjari, whose portrait on a stage showed him in a forest wearing a pair of shooting glasses and a jungle vest. “Where others were found by martyrdom, he looked for it. Praise be to God as he will have the fragrance of Imam Hussein.”