Tens of thousands of ­Palestinians have rallied in Gaza to show support for their Islamist Hamas government, which has long been at loggerheads with Israel but is now shunned by Egypt as well.

The military-backed government that toppled the Muslim Brotherhood in Cairo last year has blacklisted the Brotherhood and Hamas as terrorist groups and clamped down on people, goods and arms crossing the Sinai-Gaza border.

Hamas tried in vain to mollify Egypt by insisting its hostility was directed exclusively at Israel, but is now turning up the rhetoric.

"The punishment of the people of Gaza must end," Ismail Haniyeh, head of the Hamas government, told the rally in a speech interspersed with chants of "Jihad is not terrorism" over the loudspeakers.

Mr Haniyeh said: "We are living through a difficult stage and harsh challenges, but we are not terrified and we are not defeated. We have become familiar with difficulties and this stage is not the most difficult."

Hamas has repeatedly fought Israel, which withdrew from the Gaza Strip in 2005. The Islamists won a Palestinian legislative ­election the next year and, after a uneasy power-share with the US-backed rival faction Fatah, seized control of Gaza in 2007.

Yesterday's rally was intended to commemorate three top Hamas leaders, including the group's founder, Sheikh Ahmed Yassin, who was assassinated by Israel a decade ago.