Check out
UN Security Council Resolution 242, which is one of the keystones of this (very modern) history.
Security Council resolution, so it is considered to be binding international law. Preamble emphasizes the inadmissibility of territory gained in war, which is declared illegal in the UN Charter (and which we, the US, are upholding as a reason that Russia can't annex Ukraine).
UNSCR 242 demands (in English) that Israel withdraw "from territories" gained in the recent conflict (the 1967 war, in which Israel gained military control of Gaza from Egypt, the West Bank from Jordan, and the Golan Heights from Syria), while I believe in French it says "from the territories" gained, which has been a point of contention among scholars, diplomats, and other people to whom words matter.
Fun fact for all you history buffs, btw: Egypt and Syria were, at the time, a single state called the United Arab Republic. So Israel seized Gaza and Golan from the UAR, which broke back up into Egypt and Syria in 1971-ish.
The point, though, was not to force a unilateral Israeli withdrawal, but to push towards a negotiated settlement.
Keep in mind, though, that the question at this point was "negotiated between whom?" Jordan and Israel? UAR/Egypt/Syria and Israel? Between Israel and the people living in the West Bank and Gaza, many of whom were refugees, and all of whom had been residents of another country up until that point?
The PLO, by the way, was a thing at the time--a creation of UAR (Egyptian) intelligence, based in Cairo. No skin in the game or boots on the ground. Long story, like many of these stories.
To me, this is one of the cores of this problem: who leads the Palestinians, speaks for the Palestinians, can make and enforce agreements for the Palestinians? The UN kind of chose the PLO to be the figurehead organization, but they never really had the legitimacy to make the deals. More recently, Hamas was elected in Gaza, but as soon as they were elected they ensured that they would never be un-elected, so they're basically a mafia/terrorist organization, curiously supported by both Iran and Netanyahu (until recently).
There's a lot more to be said about the issue of territory, but this post is too long already .