On June 8, 1919, the Ukrainian forces under the new command of Oleksander Hrekov, a former general in the Russian army, started a counter-offensive, and after three weeks advanced to Hnyla Lypa and the upper Stryi river, defeating five Polish divisions. Although the Polish forces had been forced to withdraw, they were able to prevent their forces from collapsing and avoided being encircled and captured. Thus, in spite of their victories, the Ukrainian forces were unable to obtain significant amounts of arms and ammunition. By June 27 the Ukrainian forces had advanced 120 km. along the Dnister river and on another they had advanced 150 km, past the town of Brody. They came to within two days' march of Lviv.