Ecuadoran President Lenín Moreno and indigenous protest leaders have reached an accord to end the violent protests that left seven people dead and brought the South American country to a standstill — for now, at least.

The deal late Sunday to reinstate popular fuel subsidies whose repeal ignited 11 days of demonstrations were the result of negotiations brokered by the United Nations and the Catholic Church.

The announcement capped another violent day in Quito, paralyzed by protesters, sectioned off by barricades, engulfed by tear gas.

Moreno, who had repeatedly stressed the need to end thedecades-old fuel subsidies to stimulate Ecuador’s stagnant economy, hailed the agreement Sunday as necessary to restoring order.

“A solution for peace and for the country,” he said. “Peace is regained.”

As workers and protesters began a massive cleanup on Monday, the Confederation of Indigenous Nationalities of Ecuador, which led the protests, warned demonstrations could resume.

“We celebrate the victory,” the group said in a statement. “But this isn’t over until the agreement is fully completed.”

What does the agreement say?

Not all of the details have been ironed out. But the most important piece is already out of the way: The repeal of Decree 833.

The decree, announced Oct. 1 by Moreno, did away with subsidies he said were costing the country $1.3 billion annually. He announced their repeal as part of an austerity package to meet the requirements of a badly needed $4.2 billion loan from the Inter­national Monetary Fund.

Moreno said Sunday the government would replace Decree 833 with “a new one that contains mechanisms to focus resources on who needs it most.”

It is unclear when the new decree will be announced or what it might entail. But it will not “end up benefiting [only] the wealthy and smugglers,” the sides said in the agreement announced by the United Nations.

What was the impact of the subsidies?

What brought Moreno to the negotiation table was both the debilitating protests and the mounting costs of the austerity package itself.

Moreno’s elimination of the fuel subsidies drove up prices on gasoline and diesel, which leaped from around a $1 per gallon to more than $2. That led to speculation and soaring prices on many consumer goods.

Those who were hurt the most were the rural and the poor. But the impact on individuals, communities and businesses was widespread.

The demonstrations imposed new costs. Ecuador, whose economy depends on oil exports, produced roughly 430,000 barrels per day. But as protesters occupied oil fields, that number was more than halved, according to the Associated Press.

After the first week of protests, officials said disruption to transportation and commerce had cost the country more than $1 billion.

What does the agreement say about Ecuadoran politics?

Indigenous people, marginalized in many countries across the Americas, wield massive political clout in Ecuador — and have demonstrated it repeatedly.

Indigenous-led protests are widely credited with taking down three presidents in the last quarter century.

They have now brought another president to heel.

“A neoliberal government cannot sell the blood of our people to the IMF, and that is why we have declared ourselves to be in an endless struggle,” indigenous leader Jamie Vargas told Agence France-Presse last week. “We are historically warrior peoples who have liberated ourselves in all these processes.”

What's next?

Ecuador’s economy is in big trouble. Tethered to the whims of commodity markets, it has been hit hard by the international decline in oil prices. Government spending under former president Rafael Correa drove up Ecuador’s debt, compounding the problem.

Now the Central Bank is predicting the economy will contract 0.2 percent this year.

Looking for a way to change the economic picture, Moreno turned to the IMF for help. To receive a $4.2 billion loan last month, he struck a deal to get rid of the fuel subsidy, ratchet up taxes on high-income businesses and increase the number of families receiving a small monthly payment of $15.

Now Ecuador’s deal with the IMF, which hinged on the repeal of fuel subsidies, is in question.