By Jeremy McDermott
BBC News, Medellin
A crippling strike in Ecuador's oil industry has come to an end after protesters reached an agreement with the government and oil companies.
Protesters wanted oil firms to invest more in local infrastructure
The oil firms promised to invest more money in local communities in the two provinces most affected by the action.
The protesters had paralysed the oil industry and cost the government some $400 million in lost revenue.
The protesters sought an increase the amount of oil revenue invested in the region surrounding the oil fields.
The settlement came not a minute too soon.
With oil revenues accounting for about a third of total government income, the state was on its way to bankruptcy.
The demonstrators agreed to call a halt to all industrial action after the government and oil companies pledged to plough more money into health, education and infrastructure in the principal oil producing provinces.
Apart from the economic costs of the strike, the government of Alfredo Palacio feared for its very existence, and with good reason.
President Palacio took power in April, in what analysts have described as a congressional coup, after ex-President Lucio Gutierrez was driven from power by widespread protests.