The Islamist militant organization Hamas said Monday that it would not agree to a cease-fire with Israel until its demands were met, as Israel warned that its incursion into the Gaza Strip could continue for days or even weeks.

The stark assessments offered little hope for quick progress toward ending a 14-day-old conflict that has inflicted heavy costs on each side.

Seven more Israeli soldiers were killed in fierce fighting Monday, bringing the Israeli military toll to 27 dead, more than twice as many as in Israel’s last Gaza ground incursion in 2009 and the highest toll since Israel’s war with Lebanon in 2006. Two Israeli civilians have died in the conflict.

More than 560 people in Gaza, many of them women and children, have been killed since Israel’s Operation Protective Edge began.

Israeli Defense Minister Moshe Yaalon said the Gaza military operation, which is now focused on finding and destroying underground tunnels, would continue “as long as necessary until the completion of the task and the return of the quiet in the whole of Israel.”

But the most senior Hamas leader in the Gaza Strip, Ismail Haniyeh, warned that “invaders” would find a graveyard awaiting them in Gaza. In a televised broadcast, Haniyeh said Hamas fighters would not put down their weapons until Israel and Egypt agree to open border crossings, ease travel and the flow of goods, and free Hamas members who were jailed after the killing of three Jewish teenagers in the West Bank last month.

“We’ll never go back to the slow death,” Haniyeh said. “Our demands are fair and they are humane. Our people have decided.”

The Israeli military said that at least four of its soldiers were killed in a firefight with Hamas militants who sneaked into Israel through a tunnel from northern Gaza. Ten Gaza militants died in the exchange, a military spokesman said, and another underground infiltration attempt by Hamas was repelled by an Israeli airstrike.

The fresh casualties came a day after 13 Israeli troops were killed in combat in the east Gaza neighborhood of Shijaiyah on Sunday, the bloodiest day of the conflict.

Israeli airstrikes and artillery fired over the past 24 hours hit the al-Aqsa Hospital in the central town of Deir al-Balah, which Israel said was being used to hide antitank missiles, killing four, and a house in Khan Younis where a midlevel Hamas leader was believed to be. Gaza Health Ministry officials said 28 Palestinians were buried in the debris, including women and children.

With violence and the death toll rising, and as Israeli troops moved from the margins to the population centers in Gaza, diplomatic efforts to secure a truce intensified.

At the White House, President Obama said, “We don’t want to see any more civilians killed.” He instructed Secretary of State John F. Kerry to seek “an immediate cease-fire” between Hamas and Israel. Kerry arrived in Cairo on Monday night.

Children paying a terrible price in Gaza

Palestinian Authority President Mahmoud Abbas met Monday with his political rival, Hamas leader Khaled Meshal, in Qatar. According to aides traveling with Abbas, the Palestinian leader from Ramallah in the West Bank is looking for a cease-fire brokered by Egypt based on a return to the November 2012 agreement between Israel and Hamas in Gaza, according to the Israeli newspaper Haaretz.

“Everyone is supporting the Egyptian initiative for a cease-fire — the Palestinian Authority, the Arab League, the Americans, Israel,” said Tzipi Livni, Israel’s justice minister and the country’s top peace negotiator.

Livni said the only opponent to a truce was Hamas leader Meshal, who, she said, “is not even living in Gaza and who has a good life in a nice hotel somewhere but wants to continue putting his people under stress.”

But any mediation effort could run into an obstacle. If Israel agrees to a cease-fire, it would have to abandon its core objective in Gaza of destroying Hamas tunnel networks. But Israeli military officials say that they believe the tunnels are more extensive than previously thought and that it will take more time to demolish them, raising a dilemma.

“We have a mission, and we are going to fulfill it. Israel is not going to leave the threats of tunnels beneath the border between Gaza Strip and Israel,” a senior Israeli military official told reporters Sunday, speaking on the condition of anonymity because of military guidelines. But he also acknowledged that with the growing casualties on both sides, “it’s the right time for all sides to stop.”

Palestinian fighters in Gaza continued to offer stiff resistance. The number of rockets fired into Israel by Palestinian militants rebounded from a brief lull, with the Israeli military saying that more than 100 rockets struck the Jewish state Monday, mostly in southern areas close to the Gaza border.

Three rockets were fired into Tel Aviv, Israel’s second-most populated city. One struck the metropolitan area but did not inflict any casualties, the military said, while Israel’s Iron Dome missile defense system intercepted the other two.

The number of Palestinians seeking refuge with the United Nations also rose overnight, growing to at least 85,000 people now living in 67 shelters, mostly at schools, the U.N. Relief and Works Agency said Monday. U.N. agencies report that more than 100,000 Gazans have been displaced from their homes.

The United Nations also said a preliminary review in Gaza found that more than 72 percent of those killed were civilians, not militants, and include large numbers of women and children. The U.N. Office for the Coordination of Humanitarian Affairs said the high numbers of children and noncombatants raise “concern about respect for the principle of distinction and proportionality under international humanitarian law.”

Two of the Israeli soldiers killed were American citizens who had come to Israel, like many Jewish Americans, to volunteer in Israel’s army. One, Max Steinberg, was from Woodland Hills, Calif., while the other, Nissim Sean Carmeli, was from South Padre Island, Tex., Israel’s military said.

The State Department recommended Monday that U.S. citizens consider deferring non­essential travel to Israel and the West Bank, a possible economic blow to both during the peak summer tourist season.

Raghavan and Eglash reported from Jerusalem. Islam Abdul Kareem in Gaza City contributed to this report.