Meetings in Havana paved the way for negotiations that open in Oslo on Wednesday on ending long-running civil war

The ailing former Cuban leader Fidel Castro, together with Venezuela's recently re-elected leader Hugo Chávez, played a critical role in bringing the Colombian government and the deadly Farc guerrilla group together for peace talks that could end one of Latin America's longest-running civil wars, the Observer has learned.

According to sources closely involved in the peace process, which sees historic talks opening in Oslo on Wednesday, the key breakthrough after almost four years of back-channel talks between the two sides came during a visit earlier this year by Colombia's president, Juan Manuel Santos, to Cuba, where he met both Castro and Chávez, who was in Cuba being treated for cancer.

That meeting was the first of many in Havana between the two sides, facilitated primarily by Cuba and Norway with the backing of Venezuela, which saw agreement on the detailed agenda for the first round of talks this week. "Officially President Santos went to Cuba to discuss the Americas summit," said a source intimately involved in the peace negotiations. "But the purpose of that trip was to discuss the peace initiative."

The meetings earlier this year followed the decision last year by Santos to take the step of recognising that an "armed conflict" existed in his country, an initiative encouraged by Chávez since 2008. Those contacts also came in the same period that Farc announced it was ending kidnapping, one of five preconditions for talks that had been set down by Santos as a gesture of goodwill.

Farc and the government have been at war since 1964, with the group more recently accused of having taken a directing role in coca production in areas it controls, an issue that will be on the agenda for the talks.

But in what is being billed as the best chance to bring about a negotiated end to the long-running conflict, the Colombian government delegation will sit down with Farc leaders whose Interpol arrest warrants have been suspended to allow them to travel to Oslo without fear of arrest.

The government delegation, for the first time ever, will include retired generals with the trust of the country's military and representatives of Colombia's business elite, whose presence, it is hoped, will help sell any peace deal that emerges to those hostile to the process.

After the failure of the last round of peace negotiations, which foundered 12 years ago, top of the agenda will be the issues of land reform – Farc's key demand – political participation, the disarmament of the guerrilla group and the issue of paramilitaries who have in the past sought to torpedo any deal.

The disclosure of the key role of Cuba in organising support for the peace process marked the culmination of a long period of back-channel talks first initiated by Santos's predecessor as president, Alvaro Uribe, under whom Santos served as minister of defence.

During those four years contacts continued despite the death during an army operation of Farc's leader, Alfonso Cano, last year.

Others credited with having created the conditions for the talks in Norway are unnamed former participants in the Northern Ireland peace process.

The talks are due to begin amid warnings from both sides, as well as observers, that a serious threat exists from those on both sides of Colombia's political divide who might attempt to use violence to derail the process.

The attempt to reach a negotiated peace settlement foundered over a decade ago as both sides accused the other of stalling and rebuilding their forces, a period, observers say, that saw a doubling of anti-Farc paramilitaries.

A senior Colombian government source, who briefed the Observer on condition of anonymity, described the chances for talks as the best ever, adding that the Santos government had already enacted a new law for land reform and victim restitution. "President Santos is a pragmatist. He has already presented to congress a framework for an agreement. Colombia was already moving into a post-conflict phase, in some respects, even as the conflict continues. It is the right moment. Farc have a historic opportunity – probably the last – to find a solution to this conflict with dignity. To go into history and say they fought for social justice. To say they fought for land reform.

"We want to see 'Timochenko' [Rodrigo Londoño Echeverri, who took over command of Farc after Cano's death in 2011] in Colombia's congress just as we have seen Gerry Adams in the Northern Ireland assembly."

The sense of a guarded new optimism is shared by outside observers, including Marc Chernick, a US academic who has followed the history of Colombian peace negotiations and written The Farc at the Negotiating Table. Speaking from Colombia on Friday, Chernick said: "I've observed all the previous negotiations and I have been optimistic before, but this time I believe there is a real seriousness on both sides that has not been shown before.

"In the past Farc has always asked for a demilitarised zone as a precondition and this time it has not pressed for that. Four years ago it started to release prisoners, first civilians then military, and then renounced kidnapping.

"Clearly they want to talk. And they stayed at the table for the pre-negotiations even though three senior leaders were killed, including Alfonso Cano.

"Santos is clear, too. He was former minister of defence under President Uribe. They pushed the war as hard as they could and killed leaders. Now he has recognised that it will go on indefinitely. So Santos has come to the conclusion that only a negotiated solution is possible."

Chernick – like the senior government source – warned of the risk of violence during the peace talks from those, particularly on the right, opposed to peace with Farc, not least, he says, from paramilitaries who, although officially "disbanded", are still active and supported by elite sectors of society.

"What is different this time," added Chernick, "is that both sides have signed up to the idea that the intended end of the peace talks is the end of the conflict."