Some would call this well-intentioned socialism, others clientist bribery. But it doesn't really matter. What matters is that these programmes were affordable only when the price of oil was sky-high. When the price of oil collapsed a few years ago, they became unaffordable.
At this point, the government needed to make substantial cuts to the size of the state and its welfare programmes to stabilise its finances. However, such cuts are just not really possible for this kind of government: The entire basis of its power is a huge web of political patronage and self-enrichment, sitting on top of a mass of impoverished supporters. Money is the only thing that makes the system work.
Thus, the government attempted to maintain its spending through borrowing and enlargement of the money supply. Their hope was that, eventually, oil prices would rebound enough to restore the lost revenue and stabilise the economy. As they waited, their domestic and foreign opponents saw an opportunity to make the situation worse for them through measures like sanctions. However, the debt and printing of money would have lead to financial crisis sooner or later.