“The Messenger of Allah (ﷺ) ruled concerning the stream of Mahzur that the higher ground took precedence over the lower, so the higher ground should be irrigated until the water reached the ankles, then it should be released to those who were lower.
Sunan Ibn Majah Book 16, Hadith 46