Israel has attacked military targets in the Gaza Strip, after its soldiers came under gunfire at the border.

The Israeli military announced that one soldier had died from his wounds, the first in the most recent clashes.

Gaza officials said four Palestinians were killed in the strikes, three of them members of militant group Hamas.

They said a fourth Palestinian was shot dead during protests along the border. Hamas, who run Gaza, later said a ceasefire had been agreed with Israel.

"With Egyptian and United Nations efforts it has been agreed to return to the era of calm between (Israel) and Palestinian factions," Hamas spokesman Fawzi Barhoum told Reuters news agency.

Israel has yet to comment on a ceasefire.

What about the Israeli strikes?
The military said it had struck 15 Hamas military targets in the northern Gaza Strip and an additional 25 in Khan Yunis in the south, adding that the strikes were continuing.

The operation came during another Friday of protests by Palestinians at the border between Israel and Gaza. The Israeli army said three projectiles had been fired into Israel by Palestinian militants.

Israel last week carried out its biggest attack against Hamas targets in Gaza since the war in 2014, in response to more than 200 rockets and mortars fired into the country.

Palestinians have now been protesting at the border for 17 weeks. Gaza health officials say more than 130 Palestinians have been killed and 15,000 injured by Israeli forces during that time.

The death of a soldier on Friday is the first Israeli fatality in the exchanges.

Human rights groups have accused Israeli troops of using excessive force. Israel says it has only opened fire in self-defence, or on people trying to infiltrate its territory under the cover of the demonstrations.

Following Friday's clashes, the UN's envoy for the Israel-Palestinian conflict called on all sides to "step back from the brink" of war.

"Everybody understands that unless the situation is defused we will very quickly be back to another confrontation," said Nickolay Mladenov.

"I expect all parties, all sides to do their best right now. Not next month, not next week, right now, to prevent this escalation."

Mr Mladenov called specifically on Hamas and Islamic Jihad - the two largest militant factions in Gaza - to end the launch of rockets and prevent attempts by Palestinians to breach the border fence.

Israel resumed air attacks on Gaza after last week's projectile attacks, warning that it would take whatever action necessary to stop incendiary kites and balloons being flown over the border.

It accuses Hamas of controlling the makeshift devices, which have set fields in Israel ablaze, as well as orchestrating the protests at the border, which Israel regards as a threat to its border communities.

The past week had seen efforts to try to keep the situation under control, but Israel's Defence Minister Avigdor Lieberman warned on Friday of a "much tougher" response against Hamas if continued to fire rockets from the Gaza Strip.

"If Hamas continues to fire rockets then Israel will respond in a much tougher way than they think," Mr Lieberman said in a statement.