Nickolay Mladenov, United Nations Special Coordinator for the Middle East, spoke a few hours after an escalation of violence that saw 200 Gaza bullets fired at Israel and dozens of air strikes in response, Israeli forces said.
"Yesterday we were on the brink of war," Mladenov said on Sunday at a press conference in Gaza. "And it has made the combined efforts of all to make us withdraw from the confrontation. A confrontation that nobody wants, nobody needs and a confrontation from which everyone loses. "
Mladenov noted the worsening humanitarian situation in Gaza and the worsening political and security situation in the region.
"People's lives (in Gaza) have become more difficult as people have limited money, the economy has collapsed, and electricity and water are scarce," he said. "We can not be inactive when we see that two million Palestinians in Gaza are living in such terrible conditions as they are now."
"A child who is killed is too much"
He called on the Palestinians "to keep the protests peaceful" and called on the Palestinian factions not to fire rockets, mortars and fire dragons and "give peace a chance".
He appealed to Israel, demanding that the state be "reserved" in its response to the situation in Gaza, adding, "I call on snipers not to shoot children."
"Even a child who is killed is too much. In the last few weeks, too many children have been killed. "
Israel has been criticized for using fire on Palestinians at the Gaza border fence as tensions have increased since protests started against the "Great March of Return" in April.
Israel denies excessive violence against protesters and accuses Hamas, which governs Gaza, of orchestrating the protests.
"One step away from another confrontation"
In the weeks since May, there were several other acts of violence, both at the border fence and in the form of fire dragons and air raids.
In his comments, Netanyahu emphasized to Hamas, "Whoever hurts us, we will meet them with great power. We did that yesterday. I hope they got the message; if not, they will get it later. "
Two Palestinian youths were killed in Israeli air strikes on Saturday, according to the Palestinian Ministry of Health, which the IDF has called their biggest bombing campaign in Gaza since the war in 2014.
Zaki Heller, spokesman for the Israeli Medical Service, said four Israelis were injured in a rocket fire.
"We are only one step away from another confrontation," Mladenov said. "Everyone has to step back."
Need to return to the reconciliation process
The UN Coordinator called on the international community "not to forget the people of Gaza, not to mention the Palestinians who have lived without governments for generations" and to work with the United Nations to "take a political path forward".
"The only realistic perspective today is to avoid war, solve humanitarian problems in Gaza, and return to the reconciliation process."
Mladenov also assured the Palestinians that the UN will not leave Gaza, despite the "significant financial problems" of the United Nations Relief and Works Agency (UNRWA) providing Palestinian refugees in the West Bank with humanitarian aid, education, social services and medical care, Gaza Strip, Jordan , Syria and Lebanon.
CNN's Andrew Carey, Kareem Khadder, Ian Lee and Kelly McCleary contributed to the report.