Voters also offered a drubbing to a newly created party of the former rebels. The Common Alternative Revolutionary Force, which kept its wartime acronym FARC, got just a fraction of a percentage of votes. That would not have won it any legislative seats at all had it not been for a deal with the government that guaranteed the group five in each chamber.

With Congress elected, attention now turns to the presidential race, whose first round of balloting will be in May. The match appears set to be dominated by the right-wing candidate Iván Duque and Gustavo Petro, a leftist former mayor of Bogotá, the capital, each of whom won primaries on Sunday for their respective coalitions.

Also prominent in polls is Sergio Fajardo, another former mayor campaigning on a centrist platform who is known for fighting poverty and significantly improving infrastructure in his city, Medellín.

The election has been dominated by issues including street crime and corruption scandals involving public funds. A main punching bag has also been the peace deal with the FARC, which was narrowly voted down in a referendum in 2016, but forced through Congress by Mr. Santos after minor changes to the text.

While it is unlikely that major changes to the deal would be easily achieved under the new government, its divisions could mean that parts of the accord, like grants to former coca farmers who switch crops, could find themselves in the cross hairs as the next government puts them into effect.