for some way it took its course beside the river , bending with it east and then north ; but at the last it turned away and went straight towards the gates of isengard ; and these were under the mountain-side in the west of the valley , sixteen miles or more from its mouth .