Voters in Colombia have rejected a landmark peace deal with Farc rebels in a shock referendum result, with 50.24% voting against it.
The deal was signed last week by President Juan Manuel Santos and Farc leader Timoleon Jimenez after nearly four years of negotiations.
But it needed to be ratified by Colombians in order to come into force.
Addressing the nation, President Santos said he accepted the result but would continue working to achieve peace.
He said the current ceasefire remained in place and that he had ordered negotiators to travel to Cuba to consult Farc leaders on the next move.
“I won’t give up,” he said. “I’ll continue the search for peace until the last moment of my mandate because that’s the way to leave a better country to our children.”
Meanwhile the Farc leader, known as Timochenko, said the group remained committed to securing an end to the war.
The rebels earlier agreed to lay down their weapons after 52 years of conflict to join the political process.
But critics said the deal treated the Farc, which the US still considers a terrorist group, too leniently.
The agreement was rejected with 50.2% of voters against it and 49.8% in favour – a difference of less than 63,000 votes out of 13 million ballots.
The surprise result means the peace process is now shrouded by uncertainty.
Former President Alvaro Uribe, who headed the “no” campaign, said all Colombians wanted peace, but that the deal needed “corrections”.
“We want to contribute to a national accord and be heard,” he said.
Analysis – BBC South America correspondent Wyre Davies
This was arguably the most important vote in Colombia’s history and the government had hoped that the promise of peace would have persuaded a majority of voters to accept the agreement.
But with fears that too many concessions have been made to the guerrillas, by less than half of 1%, the people of Colombia rejected the agreement (although voter turnout, at only 40%, was remarkably low).
Speaking on national television shortly after the result was announced, President Santos said that a previously announced ceasefire will hold and that both sides would meet in the Cuban capital, Havana, to decide on a way forward.
While there’s clearly a will across Colombia to end more than half a century of violence, the terms of the deal still worry many Colombians.
President Santos had previously warned that there was no plan B for ending the war, which has killed 260,000 people.
The result of the vote is a major setback to the president, who since his election in 2010 had pledged to end a conflict blamed for displacing about eight million people.
Less than a week ago, he was celebrating with world leaders and Farc commanders the end of Latin America’s last and longest-running armed conflict at a ceremony in the historic city of Cartagena.
The rebels were making plans to lay down their weapons and become a political party within six months.
But the president is now facing one of the most difficult moments in Colombia’s recent history, says the BBC’s Americas Editor Leonardo Rocha.
The Farc’s 52-year fight
1964: Set up as armed wing of Communist Party
2002: At its height, it had an army of 20,000 fighters controlling up to a third of the country. Senator Ingrid Betancourt kidnapped and held for six years along with 14 other hostages
2008: The Farc suffers a series of defeats in its worst year
2012: Start of peace talks in Havana
2016: Definitive ceasefire
The 297-page peace deal is a deeply divisive issue in Colombia, and the government has been accused of taking victory for granted.
Many of those opposed to the deal were angry that it would have spared the rebels time in prison when they were responsible for so many deaths and displacements.
The government tried to offset these concerns throughout the referendum campaign by spending heavily on television adverts in addition to staging concerts and peace rallies throughout the country in a bid to get people out to vote.
It called on the support of U2’s Bono and former Beatle Ringo Starr – and for the first time in an election made ballots available in Braille so blind Colombians could vote.