Colombia’s government and rebel leaders reached a major agreement Sunday to de-escalate their conflict beginning July 20, months after a resurgence in fighting jeopardized fragile peace talks aimed at ending the country’s 50-year civil war. Sunday’s agreement now puts both sides back on track to finalizing a historic peace deal as the talks head into their final phase.

Diplomats in Havana, Cuba, where the peace negotiations are taking place, announced the agreement Sunday. “The national government, from July 20, will launch a process of de-escalation of military action in response to the suspension of offensive actions by the FARC,” the statement read, referring to a unilateral ceasefire announced by FARC leaders earlier in the week.

The de-escalation agreement puts a halt to months of uncertainty regarding the peace talks, which have been going on since 2012 and are widely considered the country’s best chance in years of ending its longstanding conflict with the Revolutionary Armed Forces of Colombia, or FARC. The future of the talks was thrown into serious doubt in April, when a FARC attack violated a previously declared ceasefire in an attack that killed 10 soldiers. The incident prompted the government to renew aerial strikes against guerrilla forces, and FARC rebels responded by attacking several oil pipelines in the country.

The resulting escalation in fighting put the talks at their “worst point” since 2012, Colombia’s chief negotiator, Humberto de la Calle, said earlier in the week. The Conflict Analysis Resource Center, a Bogota-based organization, reported that June was the most violent month in Colombia since 2012, logging 83 armed attacks from both sides, compared to just 17 in June 2014. Public opinion had also begun to shift against the peace talks in recent months, with the number of Colombians expressing support for a military solution roughly equal to the number of those supporting dialogue, according to a June Gallup poll.

Hope for the talks began resurfacing after FARC announced on July 8 that it would establish a ceasefire to begin on July 20, Colombia’s independence day. The truce announced on Sunday is only set to last for one month, but both sides have agreed tentatively to stretch it out to another four months. Analysts expect a final peace accord sometime in the first half of 2016.