This happened after he defeated Sihon king of the Amorites, who ruled in Heshbon, and then at Edrei after he defeated Og king of Bashan, who ruled in Ashtaroth.
However, when you enter Ammonite territory, don't cause them any trouble or fight with them for I'm not going to give you any Ammonite land, because I have given it to the descendants of Lot and it belongs to them.”