NAHAL OZ, Israel — Tens of thousands of Palestinians returned to the borderland between Gaza and Israel on Saturday for a largely peaceful protest marking the first anniversary of demonstrations that have frequently led to violent clashes with Israeli troops.

Despite efforts by both sides to minimize casualties, hundreds of protesters rushed the fence, some hurling homemade bombs, and three were killed.

After a round of violence on Monday that began when a rocket fired from Gaza wounded several Israelis north of Tel Aviv and ended after Israel spent a day pounding targets in Gaza, neither side was eager for a new war, least of all Israel, which is 10 days away from elections.

Egyptian intermediaries worked with both sides to keep the situation from boiling over, and Hamas, the militant Islamic group that controls Gaza, deployed scores of people in orange vests to keep most demonstrators at least 300 yards from the fence, the distance Israel had demanded as a buffer.