Washington DC CNN Business  — 

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.

Twitter is not removing posts that support Soleimani, a company spokesperson confirmed to CNN Business on Monday. It said as long as Twitter users abide by company rules, their posts will not be removed.

In a tweet condemning Instagram, Iran’s government spokesperson, Ali Rabiei, called the platform’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.

Richard Nephew, a sanctions expert and a senior research scholar at the Center on Global Energy Policy at Columbia University, said that it could be argued social media posts supporting Soleimani “are helping the Iranian government and the IRGC, which would be a violation of sanctions.”

But he added, “of course, this is a tough gray area as we also have free speech protections too. This is why I think companies often make mistakes in this area, both by preventing such posts or activities and by allowing them. It is a really murky area.”

Google did not comment on its policy when contacted by CNN Business.