BOGOTÁ, Colombia — The two candidates of Colombia’s far-right and left wing parties came out ahead in a first-round vote on Sunday to choose the country’s next leader, setting the stage for a divisive presidential election, the first since the country signed a peace deal with its rebels.

Iván Duque, 41, a conservative former senator, won about 39 percent of the vote, election officials said Sunday night. Gustavo Petro, 58, a former leftist rebel who rose to become mayor of Bogotá, the capital, won about 25 percent.

The two, who came in ahead of three other major candidates, will face each other in a second and final vote on June 17.

Regardless of the winner, the election is expected to mark a big shift from the administration of Juan Manuel Santos, a centrist whom Colombians sent twice to the presidency and who won a Nobel Peace Prize in 2016 for negotiating a peace deal with the country’s main guerrilla group.