In Chapter 26 of Genesis, Isaac brought his people to Gerar. The Philistines lived here and Abimelech was their king. God told Isaac to go there because there was famine in their country. God blessed Isaac and his people with good crops and plentiful livestock. Soon the Philistines became envious. Trouble ensued.
Isaac's wells were stopped up with dirt. When Isaac complained to King Abimelech he told Isaac to go to Wadi Gerar. Isaac's father had dug wells there, so Isaac opened them up and used them. Again the Philistines stopped them up. The Philistine shepherds argued that the wells were theirs alone. So Isaac dug up another well. That too was the source of contention. The same thing happened again.
Eventually, Abimelech came to Isaac. The king told Isaac that he could see how blessed he was in God's eyes. But Isaac and his people had to move on. Abimelech and Isaac made a peaceful covenant.
Why can't all immigration problems end in a