In 1188, Béla occupied Halych, whose prince had been dethroned by his boyars, and granted the principality to his second son Andrew, but his rule became unpopular and the Hungarian troops were expelled from Halych in 1189.