Conservative candidate and ex-prison chief Alejandro Giammattei has been elected president of Guatemala.
Preliminary results show he took 59% of the vote, while his centre-left opponent Sandra Torres won 41%.
Ex-first lady Ms Torres, who won the first round in June, was running for the third time, while Mr Giammattei was making his fourth attempt.
Shortly before being elected, Mr Giammattei said he wanted to change a controversial US migration deal.
He has been elected for a single four-year term, replacing outgoing President Jimmy Morales.
“It will be an immense honour to be president of this country that I love so much,” said Mr Giammattei.
“We will rebuild Guatemala. I have no words to say how grateful I am.”
US migration agreement ‘not right’
Mr Giammattei told Reuters he wanted to see what could be done to improve a deal agreed by Mr Morales and US President Donald Trump, which seeks to stem migration to the United States by using Guatemala as a buffer zone.
Under the agreement, migrants passing through Guatemala en route to the US would have to apply for asylum in the former rather than in the US.
“It’s not right for the country,” Mr Giammattei said. “If we don’t have the capacity to look after our own people, imagine what it will be like for foreigners.”
In the lead up to the election, both candidates said they opposed the deal, arguing that Guatemala – a country plagued by poverty and violence – does not have the capacity to process the asylum requests and even less so to look after the applicants or return them to their home countries if their requests are rejected.
President Morales signed the “Safe Third Country” agreement on 27 July, just days after President Trump had threatened Guatemala with tariffs and other sanctions.
But Mr Giammattei will not take office until January 2020, by which time the arrangement will be in full swing.
“I hope that during this transition the doors will open to get more information so we can see what, from a diplomatic point of view, we can do to remove from this deal the things that are not right for us,” he said.
Who is Alejandro Giammattei?
The 63-year-old candidate stood for the right-wing Vamos (Let’s Go) party, although in each of his four previous presidential attempts he has run for a different party.
In his campaign, Mr Giammattei promised to build “a wall of prosperity” to keep Guatemalans from migrating to the US. In order to lessen the disparity between the rich and the poor, he wants to attract more foreign investment to Guatemala by strengthening the protections granted to private property.
He said he would back a bill declaring gang members “terrorists” so that if imprisoned they would have no right to conjugal visits and would be forced to work in jail.
Mr Giammattei is a trained doctor who was named director of the Guatemalan prison system in 2006.
That same year, he led a controversial operation to take control of the Pavón prison, which had been run by inmates for a decade. Seven inmates died during the raids by the security forces.
Mr Giammattei was among eight people accused over the incident and after spending 10 months in pre-trial detention, he was acquitted due to lack of evidence.
He came fourth in the 2015 election.
How did Guatemalans feel about the election?
Many Guatemalans were unenthusiastic about this election. Voters cited insecurity as their main concern, followed by unemployment, high living costs and corruption.
The run-up was overshadowed by the fact that the two favourites to win were prevented from standing in the poll.
The former attorney-general, Thelma Alana, and Azury Ríos, the daughter of the late military ruler, Refrain Ríos Mont, were barred from running by Guatemala’s constitutional court, angering those who were planning on voting for them.
Four years after large-scale anti-corruption protests forced then-President Otto Perez Molina to resign, many Guatemalans were also fed up with scandals and feel not enough has been done by the government of Jimmy Morales to combat graft.
Corruption remains one of the top three issues voters wanted to see tackled but Mr Giammattei has not said whether he plans to renew the mandate of the UN’s International Commission against Impunity in Guatemala, which is due to expire in September.