LAGOS, Nigeria — Nigeria swallowed a hard lesson on Monday that has been inflicted on governments of developing nations the world over for years: try cutting subsidies for gas and the populace will erupt in rage.

Faced down by thousands of demonstrators, demands for his removal and a weeklong general strike that paralyzed his fractious country, President Goodluck Jonathan abruptly gave in, partly restoring the fuel subsidy that — more than an Islamic insurgency in the north or a long-running conflict in the south — seemed to crystallize the frustrations of the people and draw them to the streets in outrage.

“Government appreciates that the implementation of the deregulation policy would cause initial hardships,” Mr. Jonathan said in a stiffly worded capitulation on Monday, after a week of refusing to back down.

Similar scenes have played out around the world in recent years, from Latin America to the Middle East to Asia, and the government response is frequently the same: give in quickly, despite the counsel of economists and international financial institutions that fuel subsidies are wasteful and distorting, sapping governments of money that could otherwise be used to improve education, public health or other needs.