Israel refused on Friday to fully open crossings with the Gaza Strip and Palestinian militants attacked Israel with mortars, further testing an already fragile truce.

For the third day in a row, Israel prevented food trucks from entering Gaza by closing crossings in retaliation for repeated Palestinian rocket attacks, Israeli army spokesman Peter Lerner said. Later in the day, Palestinian militants fired two mortar shells toward Israel, Israeli police said, but no injuries or damage were reported. It was not immediately clear which militant faction fired the shells.

The six-month truce worked out during months of Egyptian mediation began June 19. But only five days into the cease-fire, the Islamic Jihad group fired three rockets toward Israel, injuring two Israelis, and prompting Israel to close the crossings beginning Wednesday. Since then, Israel has not allowed food into Gaza, Lerner said.

Israel has said it will not let a humanitarian crisis develop in the territory of 1.4 million Palestinians.

As part of the cease-fire, Israel had begun easing the closure Sunday, letting in shoes and other goods in addition to the basic foods that were allowed in before the truce. Israel imposed the blockade when the Islamic Hamas seized power in Gaza a year ago, and intensified it in response to ongoing rocket attacks on Israeli communities.

Much rests on the truce, with Israel threatening a large-scale military operation if the rocket fire continues. Such a campaign would certainly bring high death tolls on both sides and could prompt the moderate Palestinian leadership in the West Bank to call off U.S.-backed peace talks with Israel that are supposed to bring a final deal by the end of the year.

Hamas wants to end the blockade of Gaza, which has brought hardship on the people under its control. Hamas leaders said repeatedly this week that they are committed to the truce, despite the ongoing rocket fire by militant groups. The smaller militant factions behind the fire say it was retaliation for the killing of two Palestinian militants in an Israeli raid this week in the West Bank, which is not included in the truce arrangement.

Hamas Prime Minister Ismail Haniyeh on Friday appealed to the factions to honor the truce for the good of the Palestinian civilian population.

"We expect everyone to respect the agreement," he told reporters outside a Gaza mosque after Muslim prayers. "So that the Palestinian people achieve what they look for, an end to this suffering and breaking the siege."

But if Hamas does not stop the rockets and if more Israelis are hurt, Israel could launch retaliatory strikes that would most likely lead to a complete collapse of the cease-fire. Palestinians have launched at least seven rockets and mortars toward Israel since the cease-fire began.

Israeli Foreign Minister Tzipi Livni called for retaliation for the attacks.

"I am not interested who fired and who didn't fire at Israel," she told reporters Thursday. "It is a violation, and Israel needs to respond immediately, militarily, for every violation."

A U.N. official said Friday that Israeli troops have violated the truce by opening fire several times at Palestinians approaching the Gaza-Israel border fence. Two Palestinians were wounded in separate incidents this week, the official said, speaking on condition of anonymity because there has been no official announcement from the U.N.

In response, the army said soldiers fired warning shots on several occasions to drive away people approaching the border, but it was unaware of any Palestinian casualties.

Troops will not allow anyone close to the volatile frontier, the military said. Militants, often dressed in civilian clothing, have planted bombs and attacked army positions along the fence in the past.

An Israeli envoy headed to Egypt Thursday in an effort to work out the final phase of the truce. Egypt hopes to get Israel to swap hundreds of Palestinian prisoners in exchange for Hamas' release of an Israeli soldier held captive for two years.

Hamas demands that Israel allow the reopening of Gaza's only border crossing with Egypt, but Israel has said it will not allow the reopening of Rafah until the soldier is freed.