USSR fell apart, the Armenian and Azerbaijan SSR became independent. Nagorno-Karabakh was a protected Armenian territory in USSR, but UN border agreement didnt take this into account.
So first Armenia waged war on the azeris for the territory. Then, once they built up their military from oil income and the larger population, azeris attacked in response. Now they successfully overwhelmed Armenias forces there, mainly eminating from severed Russian influence in the region.