Egypt’s Muslim Brotherhood said Friday the United States was not responsible for an anti-Islam film that sparked violent protests and also called for demonstrations to remain peaceful.

In a letter to the New York Times, the Brotherhood’s deputy leader Khairat el-Shater said Egyptians have the right to protest the offensive Internet video but that the storming of the US embassy in Cairo was “illegal”.

“Despite our resentment of the continued appearance of productions like the anti-Muslim film that led to the current violence, we do not hold the American government or its citizens responsible for acts of the few that abuse the laws protecting freedom of expression,” he wrote in the letter.

“In a new democratic Egypt, Egyptians earned the right to voice their anger over such issues, and they expect their government to uphold and protect their right to do so. However, they should do so peacefully and within the bounds of the law.

“The breach of the United States Embassy premises by Egyptian protesters is illegal under international law. The failure of the protecting police force has to be investigated.”

On Tuesday an angry mob demonstrated against the film — an amateurish online video that insulted the Prophet Mohammed — and a small group scaled the embassy walls and tore down a US flag, replacing it with a black Islamist one.

The protests, which came on the 11th anniversary of the September 11 attacks, drove a rift between Cairo and Washington, which has demanded that Egyptian authorities do more to protect diplomatic facilities and staff.

El-Shater expressed “condolences to the American people” over the killing of US ambassador Chris Stevens and three other Americans in an assault on the US consulate in the Libyan city of Benghazi during similar protests.

Egyptian President Mohamed Morsi — the country’s first Islamist leader and a former senior member of the Muslim Brotherhood — has condemned the film while calling on Egyptians to keep their protests peaceful.

Morsi faces pressure from US President Barack Obama — who said Wednesday that Egypt was neither an ally nor an enemy — and his own Islamist constituency as he navigates a complicated political transition in the wake of last year’s overthrow of longtime ruler Hosni Mubarak.

“We hope that the relationships that both Americans and Egyptians worked to build in the past couple of months can sustain the turbulence of this week’s events,” Shater said.

“Our nations have much to learn from each other as we embark on building the new Egypt.”