© MEHDI GHASEMI/AFP/ISNA/AFP via Getty Images (FILES) In this picture taken on September 14, 2013, the commander of the Iranian Revolutionary Guard's Quds Force, Gen. Qassem Soleimani, is seen as people pay their condolences following the death of his mother in Tehran. For a man widely reported to be playing a key role in helping Iraq's routed military recover lost ground, Qassem Soleimani, 57, the commander of Iran's feared Quds Force, remains invisible. AFP PHOTO/ISNA/MEHDI GHASEMI (Photo by MEHDI GHASEMI / ISNA / AFP) (Photo by MEHDI GHASEMI/ISNA/AFP via Getty Images)

Instagram and its parent company Facebook are removing posts that voice support for slain Iranian commander Qassem Soleimani to comply with US sanctions, a Facebook spokesperson said in a statement to CNN Business Friday.

The Iranian government has called for nationwide legal action against Instagram in protest, even creating a portal on a government website for the app's users to submit examples of posts the company removed, Iranian state media reported.

Instagram is one of the few western social media platforms that is not blocked in Iran. Facebook and Twitter are blocked but some Iranians access those sites using VPNs.

In a tweet, Iran's government spokesperson, Ali Rabiei, called Instagram's actions "undemocratic."

Instagram shut down Soleimani's own account on the platform last April after the US government designated the Islamic Revolutionary Guard Corps (IRGC) a foreign terrorist organization. Soleimani was an IRGC commander.

"We operate under US sanctions laws, including those related to the US government's designation of the IRGC and its leadership," a Facebook spokesperson said in a statement.

Iranian soccer player Alireza Jahanbakhsh, who has a verified Instagram account, posted a photo of Soleimani after his death. Jahanbakhsh said Instagram had removed that post.

Details of the takedowns were reported earlier by Coda Story.

As part of its compliance with US law, the Facebook spokesperson said the company removes accounts run by or on behalf of sanctioned people and organizations.

It also removes posts that commend the actions of sanctioned parties and individuals and seek to help further their actions, the spokesperson said, adding that Facebook has an appeals process if users feel their posts were removed in error.

CNN Business has reached out to Twitter and Google for comment to ask how they handle content related to people sanctioned by the US government.