Colombians have narrowly rejected a peace deal with Marxist insurgents, plunging the nation into uncertainty and handing a major defeat to President Juan Manuel Santos, who had staked his reputation on ending the 52-year war.
Before Sunday's referendum, Mr Santos, 53, said he had no plan B and would return Colombia to war if the no vote won.
Opinion polls had shown he would comfortably win and then be able to start implementing the deal painstakingly negotiated in Cuba over the past four years to end the longest-running conflict in the Americas.
But Colombian voters confounded that forecast as the no camp won with a tiny margin of 50.23 percent to 49.76 as votes were counted from 99.59 percent of voting stations.
Opponents of the pact believed it was too soft on the FARC rebels by allowing them to re-enter society, form a political party and escape traditional jail sentences.
They want a renegotiation of the deal.
"I voted no. I don't want to teach my children that everything can be forgiven," said Alejandro Jaramillo, 35, angered that the rebels would not serve jail time.
Sunday's vote had asked for a simple yes or no on whether Colombians supported the accord signed last Monday by Santos and the rebel commander known as Timochenko.
The Revolutionary Armed Forces of Colombia, known as FARC, whose numbers were halved to about 7000 in recent years because of a US-backed military offensive, had agreed to turn in weapons and fight for power at the ballot box instead.
Influential former President Alvaro Uribe led the no camp, arguing that rebels should pay for crimes in jail and never be given congressional seats.
Under the accord, the FARC, which began as a peasant revolt in 1964, would have been able to compete in the 2018 presidential and legislative elections and have 10 unelected congressional seats guaranteed through 2026.
It would also have given up its role in the lucrative illegal drug trade and taken part in reforming rural Colombia.
But controversially, many rebel leaders who ordered killings, bombings and displacements would have had to appear before a special tribunal that could sentence them to alternative punishments like clearing landmines.
For decades, the FARC bankrolled the longest-running conflict in the Americas through the illegal drug trade, kidnapping and extortion, spreading a sense of terror that left few Colombians unaffected.
The conflict took more than 220,000 lives and displaced millions of people.