HAVANA – Colombia’s government and leftistárebels announced Wednesday that they have reached a deal on a cease-fire that would be the last major step toward ending Latin America’s oldest guerrilla war.

President Juan Manuel Santos will travel to Cuba Thurs- day to unveil details of the agreement with the Revolutionary Armed Forces of Colombia, or FARC. U.N. Secretary-General Ban Ki-moon announced he also would be present to witness the signing of the accord. Colombia’s conflict has killed more than 220,000 people and displaced millions. But a 15-year, U.S.-backed military offensive thinned the rebels’ ranks and forced its aging leaders to the negotiating table in 2012.

Momentum had been building toward a breakthrough after Santos said this week that he hoped to end a half-century of bloodshed by July 20, marking Colombia’s declaration of independence from Spain. But Wednesday’s agreement went further than expected, removing all doubt that a final deal is around the corner.

In addition to announcing a framework for the cease-fire, both sides said they agreed on how the FARC’s estimated 7,000 fighters will demobilize and hand over their weapons, as well as the security guarantees that will be provided to leftist activists after the conflict ends. Negotiators in January tasked the U.N. with monitoring adherence to an eventual cease-fire and resolving disputes emerging from the demobilization.

“Tomorrow will be a great day,” Santos blasted out on Twitter. “We’re working for a Colombia in peace, a dream that’s beginning to become reality.” The presidents of Cuba, Venezuela and Chile – the three nations sponsoring the now almost four-year-old peace talks in Havana – were also expected to attend Thursday’s ceremony, and the Obama administration was sending its special envoy to the talks, former diplomat Bernard Aronson.

With the latest advances, only few minor pending items remain, the biggest being how the final deal will be ratified and given legal force so that it won’t unravel should a more conservative government succeed Santos, who leaves office in 2018. The two sides must also settle on a mechanism for selecting judges who will preside over special peace tribunals evaluating the war crimes of guerrillas as well as the military.

The peace talks have been bumpy and extended much longer than Santos or anyone else anticipated. But if a final deal is reached, it would end Latin America’s last major insurgency, one accused of being a major supplier of cocaine to the U.S.

Still, the much-smaller and more recalcitrant National Liberation Army has a toehold in some areas and could fill the void left by the FARC.á The ELN agreed to a peace process with the government earlier this year but those talks have yet to start because of Santos’ insistence the group renounce kidnapping.

Santos has vowed to put the FARC deal to a referendum vote so Colombians can express their opinion. Opinion polls show the FARC are widely despised among Colombians and frustration with the rebels has grown as the talks have dragged on, making the task of reconciliation much harder.

Reflecting some of that pessimism, midday news broadcasts across Colombia led off not with the progress being made in Havana but another battle of sorts: Wednesday’s night semi-final match in the Copa America soccer tournament between Colombia and Chile.