He had taken about 5,000 men and had set them in ambush between Bethel and Ai on the west side of the city. Bible see other translations

“on the west side of the city.” So the attack is the main army on the north of Ai, with the ambush force on the west of it.

Commentary for: Joshua 8:12