Colombia took a major step toward ending its five decades of war on Wednesday with a historic deal between the government and leftist Farc rebels on issues of justice and reparations to victims of one of the world’s longest-running conflicts, clearing the path for a final peace deal to be signed within months.

In an unprecedented joint announcement in Havana, Colombia’s president, Juan Manuel Santos, and Farc’s chief, Rodrigo Londoño – known as Timochenko – said the two sides had agreed on a formula for transitional justice for conflict-related crimes such as kidnapping, murder, forced displacement, disappearance and torture, one of the most complex issues on the negotiations.

The two sides also agreed to sign a final deal by March 2016 and the Farc committed to put down their weapons within 60 days after the broad pact is reached.

Santos and Londoño shook hands with each other at the end of the ceremony, and with Cuba’s president, Raúl Castro. Cuba has been hosting the peace talks in Havana since they began three years ago.

Santos said after negotiators signed the historic agreement: “We are adversaries, but we are advancing in the same direction.”

Timochenko said the agreement created a “propitious environment” to reach agreements on the remaining points of negotiation.

The two sides agreed to create special tribunals, which will include international judges, to prosecute and judge crimes related to the conflict committed by both members of the Farc and state agents, as well as non-combatants. Those who immediately confess to the crimes will face confinement – though not jail – of between five and eight years. Those who confess once a trial has started, will be eligible for reduced sentences to be served in jail. And those convicted, without having confessed, face up to 20 years in prison.

Political crimes, such as merely belonging to the Farc, will be eligible for amnesty and pardons. The attorney general, Eduardo Montealegre, said that could cover as many as 15,000 people, including fighters in arms and civilian militia members.

The Farc had repeatedly said it would never accept jail time for acts committed in what it considered a legitimate fight against the state. The formula for transitional justice presented on Wednesday allows the guerrillas to avoid jail as long as they take responsibility for their crimes.

The US secretary of state, John Kerry, welcomed the deals, saying they “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,” he said.

With the deal on justice, the two sides have reached agreement on four of the six points of negotiation, including rural development, political participation for demobilised guerrillas, drug trafficking. Still pending is a deal on how the guerrillas will demobilise and decommission their weapons, and how to implement the accords.

The government acknowledged that not everyone would be happy with the deal.

“The main point of all these negotiations is where to draw the line between justice and peace. it doesn’t matter where you draw it, some people with not be satisfied,” Santos said on Tuesday in a veiled allusion to the announcement that was to come.

One victim of the Farc from Cauca province, who asked to be identified as Alicia, said the deal was an “injustice” for those who have suffered at the hands of the guerrillas. “The government is giving prizes to the aggressors, and we, the victims are left with nothing,” said Alicia, whose brother was killed by the Farc in 2007. “They should be made to pay for everything they’ve done. Isn’t that the idea?”

In June 2015, the two sides agreed to create a separate truth commission, whose findings would not carry the weight of a judicial process, once the final peace accord was signed.

Top Farc leaders are also wanted in US courts on drug trafficking charges, but top US officials have indicated that it would not let the extradition requests stand in the way of a peace deal.

The former president Alvaro Uribe, whose tough policies against the Farc from 2002-2010 were crucial to getting the guerrillas to the negotiating table, has been sharply critical of the peace process started by Santos. In a statement read after the deal was announced Uribe said it would “generate new violence” in the country and criticized the fact that it puts the guerrillas and army soldiers on the same level.

Since the Farc reinstated a unilateral ceasefire in July, violence in Colombia has dropped to levels not seen since 1975, according to Cerac, a Bogota-based conflict monitor. In response to the Farc ceasefire, Santos ordered the suspension of airstrikes against the rebels, although other military operations have continued.