BEIRUT (Reuters) - Thousands of people took to the streets of Tehran on Wednesday to bury a soldier whose beheading by Islamic State has come to symbolize the righteousness of Iran’s military involvement in Syria.

Slideshow ( 2 images )

In what has become an iconic image on Iranian media, 25-year-old Revolutionary Guard Mohsen Hojaji is shown looking calmly into camera after his capture as he is led away by an insurgent with blood on his face, holding a knife. The photograph was posted by Islamic State.

Even Iranians critical of their government’s military intervention in Syria to help President Bashar al-Assad have taken to social media to express their admiration for Hojaji, who was killed last month.

The Revolutionary Guards, Iran’s most powerful military force who also oversee an economic empire worth billions of dollars, were initially quiet about their role in Syria.

But in recent years, as casualties have mounted, they have been more outspoken about their engagement, framing it as an existential struggle against the Sunni Muslim extremists of Islamic State who see Shi’ites, the majority of Iran’s population, as apostates.

Guards killed in Syria and Iraq are touted as protectors of Shi’ite holy sites and labeled “defenders of the shrine” on websites linked to the Guards.

Supreme leader Ayatollah Ali Khamenei prayed over Hojaji’s coffin and met with his family on Wednesday, state media reported.

Large crowds carrying red flags, symbolizing martyrdom, and pictures of Hojaji processed to the funeral in Tehran, pictures on state TV showed. Parliament speaker Ali Larijani and former president Mahmoud Ahmadinejad were among the dignitaries who attended, state media said.

“Look at what a stir the martyrdom of this youth has created in the country,” Khamenei said, according to his website.

Hojaji’s funeral comes only three days before Ashura, one of the most important religious events for Shi’ites and a traditional period of mourning which commemorates the death of Imam Hussein, the grandson of the Prophet Mohammed.

The Guards recovered Hojaji’s body through a deal between Islamic State, the Syrian army and Lebanese Shi’ite group Hezbollah. More than 300 IS fighters and about 300 family members were allowed to evacuate Syria’s western border with Lebanon under the ceasefire agreement.

On June 7, Islamic State claimed an attack on Tehran’s parliament and the mausoleum of Ayatollah Ruhollah Khomeini, the founder of the Islamic Republic, killing 18 people. The Revolutionary Guards fired missiles at Islamic State bases in Syria on June 18 in response.