The war in Gaza threatened to erupt again on Monday following a lull in fighting after several children and adults were killed when missiles struck a refugee camp and the compound of Gaza's biggest public hospital, and four Israelis died in a mortar attack near the Gaza border.

The renewed bloodshed added urgency to international calls for a ceasefire. The UN secretary general, Ban Ki-moon, reiterated the security council's call for an immediate and unconditional ceasefire, demanding that both Israel and Hamas end the fighting "in the name of humanity".

The Israel Defence Forces later warned residents of neighbourhoods in northern Gaza – including Sujiai'iya, the scene of some of the most intense fighting in the three-week war – to evacuate immediately, suggesting an escalation of military action was imminent.

Ten people were reportedly killed at the beachfront Shati refugee camp shortly after the Shifa hospital in Gaza City, the scene of countless horrors in the past three weeks, was struck on Monday afternoon.

The incidents followed the end of a 24-hour unilateral ceasefire declared by Hamas to mark the start of the Muslim holiday of Eid.

Israel swiftly denied that its forces were responsible for the strike on the hospital, saying rockets launched by militants had misfired, contradicting reports from medical staff and other witnesses. Israel has previously accused Hamas militants of hiding in the hospital premises.

In southern Israel, a Palestinian mortar strike from Gaza killed four people, Israeli medical officials said. A number of others had been wounded in the attack, they said. It was not confirmed whether the victims were military or civilian.

Following the end of the Hamas-declared 24-hour ceasefire at 2pm, there was renewed rocket fire from Gaza. Warning sirens sounded across southern Israel, and the Israeli authorities reported several rockets landing on open ground.

The Israel Defence Forces warned that it would respond to rocket fire with further air strikes. "The IDF is free to attack after any fire," Israel's chief military spokesman, Brigadier General Motti Almoz, told Israel Radio.

In New York, Ban accused the Israeli prime minister, Binyamin Netanyahu, and Hamas leader-in-exile Khaled Mishal of being "morally wrong" for allowing civilians to be killed in the conflict. He urged both sides to demonstrate "political will" and "compassionate leadership" to end the bloodshed.

Gaza was in a "critical condition" following three weeks of military offensive which raised "serious questions about proportionality", he told reporters.

According to the United Nations, more than 20 hospitals and medical centres have been hit by Israeli shelling since the start of the conflict, three weeks ago on Tuesday. The World Health Organisation said it was "appalled by the continuing trend for healthcare facilities, staff and vehicles to come under direct fire in Gaza since the escalation of violence".

The UN and US president Barack Obama called for an immediate and unconditional ceasefire. The calls followed a series of unilateral ceasefire announcements by both sides, each of which was rejected by the other amid mutual blame and recrimination.

A statement issued by the UN security council just after midnight in New York, called on the parties to the conflict "to accept and fully implement the humanitarian ceasefire into the Eid period and beyond" and "to engage in efforts to achieve a durable and fully respected ceasefire, based on the Egyptian initiative".

It noted "grave concern regarding the deterioration in the situation as a result of the crisis related to Gaza and the loss of civilian lives and casualties" and called for Israel and Hamas to respect international law.

Obama told Netanyahu of his concern at the rising number of civilian deaths and urged an immediate, unconditional ceasefire.

Saying the US backed a ceasefire plan tabled two weeks ago by Egypt, Obama stressed the importance of "ensuring Israel's security, protecting civilians, alleviating Gaza's humanitarian crisis and enacting a sustainable ceasefire that both allows Palestinians in Gaza to lead normal lives and addresses Gaza's long-term development and economic needs, while strengthening the Palestinian Authority".

But amid a confusing sequence of temporary ceasefires, there was little sign of a longer-term deal to end the military confrontation. The US secretary of state, John Kerry, returned to Washington at the weekend after his efforts to forge a ceasefire agreement between the two sides failed.

Kerry said the work to continue an unconditional humanitarian ceasefire would continue.

"Our discussions over there succeeded in putting a 12-hour humanitarian ceasefire in place," he said, adding that there were "regrettably" misunderstandings, between both sides, about the terms of the short pause in fighting.

Kerry said the immediate humanitarian break in conflict was an essential precursor to a more permanent cessation in hostilities.

"We believe that the momentum generated by a humanitarian ceasefire is the best way to be able to begin to negotiate and find out if you can put in place a sustainable ceasefire – one that addresses all of the concerns."

He said that while the underlying causes of the conflict "obviously [would] not all be resolved" in the context of a sustainable ceasefire, it was essential to begin the process.

Kerry said any process to resolve the crisis in a lasting way "must lead to the disarmament of Hamas".

Mishal told PBS that Israel must end its occupation. "We are not fanatics. We are not fundamentalists. We are not actually fighting the Jews because they are Jews per se. We do not fight any other races. We fight the occupiers," he said.

In Egypt, former president Mohamed Morsi, who was overthrown in a military coup a year ago, praised the "resistance" in Gaza.

"Our compass is set on supporting Palestine against the usurping occupier and we are with any resistance against any occupier," he said in a message posted on his official Facebook page. "A full salute to those who resist and to the revolutionaries."

Hamas is an offshoot of Egypt's Muslim Brotherhood, which has been outlawed under the regime of Abdel Fatah al-Sisi.