HAVANA/BOGOTA (Reuters) - Colombia’s government and leftist FARC rebels signed a historic ceasefire deal on Thursday that brought them tantalizingly close to ending the longest running conflict in the Americas.

The accord, capping three years of peace talks in Cuba, sparked celebrations and tears of happiness among some in the Colombian capital. It sets the stage for a final deal to end a guerrilla war born in the 1960s out of frustration with deep socio-economic inequalities that outlived all other major uprisings in Latin America.

“May this be the last day of the war,” said bearded FARC commander Rodrigo Londono, better known by the nom de guerre Timochenko, his voice choked, after shaking hands with Colombian President Juan Manuel Santos at a ceremony in Havana.

Santos, 64, is half-way through his second term and has staked his legacy on peace in the face of opposition from sectors of the country who think the FARC should be crushed militarily.

“This means nothing more and nothing less than the end of the FARC as an armed group,” Santos said, adding that the final peace deal would be signed in Colombia. “The children and youth of our country have never known a single day without the violence of the conflict. Neither have the adults.”

In Colombia, even before Santos spoke, church bells pealed at noon to mark the start of the signing. Crowds in Bogota, the capital, gathered around giant TV screens set up in the streets, dancing, cheering and clapping as the ceremony unfolded.

One placard read, “we’ve finished the war, now let’s build peace.”

About 1,000 people gathered in the Plaza Bolivar, the city’s main square, to celebrate despite rain. Some waved flags and balloons, others hugged and wiped their eyes.

“I’m 76 and have lived this war all my life – I never thought the time would come when these characters would sign peace. I’m so happy – I can die in peace,” said Graciela Pataquiva, a retired teacher, crying as she spoke.

Santos’ government says a final deal, which he said will be ready by July 20, would add one percentage point annually to economic growth in Colombia, which over the past two decades has turned itself around from a failing state to an emerging market darling.

Thursday’s agreement went further than many had hoped, with the FARC committing to putting a final accord to the Colombian people in a plebiscite, a promise made by Santos that had been a key sticking point.

Not everybody supports the peace process, and Santos will have to work hard to convince opponents to back it in a referendum.

Former President Alvaro Uribe, the leading critic of the talks, said the agreement was “a surrender to terrorism” by Santos.

Slideshow ( 10 images )

Under the agreement read out by mediators Norway and Cuba, the rebels will lay down their arms within 180 days of a final accord and demobilize into 23 temporary zones and eight camps. The ceasefire will only kick in when the final deal is agreed, although the two sides effectively stopped attacks almost a year ago and violence is already at historic lows.

During their transition to democratic politics, the FARC’s weapons will be handed over to the United Nations, which will begin a mission to verify the ceasefire.

The government will guarantee the safety of ex-rebels and their political allies, who have historically been targets for right-wing paramilitary groups, the accord said. Special protection units, comprised of both ex-rebels and security forces, will guard FARC politicians and other community leaders.

Slideshow ( 10 images )

Under accords already struck in Cuba, perpetrators of the worst crimes in the war will face “transitional justice” aimed more at finding out the historical truth than meting out harsh punishments.

“This is an extraordinary achievement. But there are serious challenges ahead related to security, implementation and guarantees of no repetition,” said Roddy Brett, director of peace and conflict studies at the University of St. Andrews in Scotland.

“WHAT ABOUT THE OTHERS?”

The FARC, or Revolutionary Armed Forces of Colombia, was one of many 20th century Latin American guerilla movements inspired by Marxist ideology and the success of the 1959 Cuban revolution. Its conflict began an as a peasant revolt before exploding into a war that killed at least 220,000 and displaced millions.

Across the region, other rebellions were either crushed by right-wing military governments or convinced to lay down their arms and join conventional politics by the 1990s. But funded by its involvement in the cocaine industry, the FARC grew to a 17,000 strong force operating across vast swaths of territory. Kidnappings for ransom also helped bankroll the rebel group.

That began to change in 2002, when Uribe launched a U.S.-backed counterinsurgency campaign that killed many FARC leaders and reduced it to an estimated 7,000 fighters.

Even after peace with the FARC, formidable obstacles will remain. The smaller National Liberation Army (ELN) only recently said it would start talks, while gangs born out of right-wing paramilitary groups have taken over drug trafficking routes, filling the vacuum left by rebels, some say.

“It’s great to end the war with the FARC, but we’ve got to be serious, we finish with the FARC but what about all the others?” said Jhon Duarte, a 26-year old mechanic, echoing the concerns of many Colombians.

Despite the challenges and the opposition from some quarters to letting FARC rebels re-enter society after years of kidnapping and attacks across the country, the mood on Thursday was buoyant.

“This is a beacon of hope, our children will be able to enjoy what we could not - a childhood of peace and a life in peace,” said Adriana Beltrán, a 25-year-old housewife in Bogota.