Desmond Boylan, Associated Press
Cuba's President Raul Castro, center, encourages Colombian President Juan Manuel Santos, left, and Commander the Revolutionary Armed Forces of Colombia or FARC, Timoleon Jimenez to shake hands, in Havana, Cuba, Wednesday, Sept. 23, 2015. In a joint statement, Santos and the FARC said they have overcome the last significant obstacle to a peace deal by settling on a formula to compensate victims and punish belligerents for human rights abuses.

HAVANA — Colombian President Juan Manuel Santos and leftist guerrilla commanders on Wednesday announced an important breakthrough in peace talks that sets the stage to end Latin America's longest-running armed conflict.

In a joint statement from Cuba, Santos and the Revolutionary Armed Forces of Colombia said they have overcome the last significant obstacle to a peace deal by settling on a formula to punish belligerents for human rights abuses committed during decades of bloody, drug-fueled fighting.

Rebels that confess their crimes to special peace tribunals, compensate victims and promise not to take up arms again will receive a maximum 8 years of restrictions on their liberty in special conditions still be to determined. War crimes committed by Colombia's military will also be judged.

Santos flew earlier in the day to Havana, where talks with the rebel group known as the FARC have been going on for three years, to make the announcement. The breakthrough came after Pope Francis, in a visit to Cuba this week, warned the two sides that they didn't have the right to fail in their best chance at peace in decades.

"I want to recognize and value the step that the FARC has taken today," said Santos, minutes before a historic, cold-faced handshake with the FARC's top military commander, known by his alias Timochenko. "We are on different sides but today we advance in the same direction, in the most noble direction a society can take, which is toward peace."

Santos said the FARC vowed to demobilize within 60 days of a definitive agreement, which he said would be signed within six months. Negotiators must still come up with a mechanism for rebels to demobilize, hand over their weapons and provide reparations to their victims. Santos has also promised he'll give Colombians the chance to voice their opinion in a referendum and any deal must also clear Congress.

U.S. Secretary of State John Kerry said he had called Santos to congratulate him and his negotiating team.

"The announcements made today at the peace talks in Havana represent historic progress toward a final peace agreement to end more than 50 years of armed conflict. Peace is now ever closer for the Colombian people and millions of conflict victims," Kerry said in a statement.

As part of talks in Cuba, both sides had already agreed on plans for land reform, political participation for guerrillas who lay down their weapons and how to jointly combat drug trafficking. Further cementing expectations of a deal, the FARC declared a unilateral cease-fire in July and has been working with Colombia's military on a program to remove tens of thousands of rebel-planted land mines.

But amid the slow, but steady progress, one issue had seemed almost insurmountable: How to compensate victims and punish FARC commanders for human rights abuses in light of international conventions Colombia has signed and almost unanimous public rejection of the rebels.

The FARC, whose troops have thinned to an estimated 6,400 from a peak of 21,000 in 2002, have long insisted they haven't committed any crimes and aren't abandoning the battlefield only to end up in jail. They say that they would only consent to prison time if leaders of Colombia's military, which has a litany of war crimes to its name, and the nation's political elite are locked up as well.

"It's satisfying to us that this special jurisdiction for the peace has been designed for everyone involved in the conflict, combatants and non-combatants, and not just one of the parties," Timochenko, whose real names is Rodrigo Londono, said in a brief statement sitting alongside Santos and Cuban President Raul Castro. "It opens the door to a full truth."

The government has gone to great lengths to insist that its framework for so-called transitional justice doesn't represent impunity for guerrilla crimes such as the kidnapping of civilians, forced recruitment of child soldiers and heavy involvement in cocaine trafficking, for which the FARC's top leadership has been indicted in the U.S.

But even before details have become known, conservative critics lashed out at what they said was excessive lenience on the part of the government, foreshadowing the difficult road ahead to implement any final agreement.

"Santos, it's not peace that's near, it's the surrender to the FARC and the tyranny of Venezuela," former President Alvaro Uribe, whose military offensive last decade winnowed the FARC's ranks and pushed its leaders to the negotiating table, said in a message on Twitter. "Without jail time for the commanders, there will be a deal in Havana but also a recipe for more violence in Colombia."

Goodman reported from Bogota, Colombia. AP Writers Jacobo Garcia, Libardo Cardona and Cesar Garcia contributed to this report from Bogota.

Follow Goodman on Twitter: https://twitter.com/apjoshgoodman