MEDELLÍN, Colombia — Iván Duque, a conservative former lawmaker, will be sworn in as Colombia's next president after he swamped his leftist rival in the country's second-round election on Sunday.

Colombia's election authority said Duque — at 41 years old, the country's youngest president-elect for more than a century — had won 54 percent of the popular vote, leading former Bogotá Mayor Gustavo Petro by more than 2 million votes, with nearly all votes counted.

Petro took 41.8 percent, while 4.2 percent of voters cast blank ballots, a popular form of political protest in Colombia.

"A new generation has arrived to govern Colombia with the largest vote in the country's history," Duque said in a victory speech at his Democratic Center party's headquarters in Bogotá.

Petro conceded defeat but pointed to the 8 million Colombians that had voted for his proposals.

"What defeat? Eight million free Colombians making a stand," he tweeted. "There's no defeat here. For now, we won't be in government."

Duque's pro-business platform and hard-line approach to security were attractive to voters during a runoff campaign that pitted hard right against hard left after a first round last month eliminated the more centrist candidates.

Duque led that contest with 39 percent of the vote, falling short of the majority required to avoid a runoff.

Duque, a former lawyer at the Washington-based Inter-American Development Bank, or IDB, who will take office for a four-year term in August, has pledged to cut taxes, lure foreign investors and bolster the military.

He also plans to amend a peace deal signed in 2016 by the government of outgoing President Juan Manuel Santos and leaders of the Revolutionary Armed Forces of Colombia to formally end a five-decade civil conflict that left more than 220,000 people dead and millions more internally displaced.

Duque and his supporters said the agreement, which is already showing signs of fracture, would let demobilized rebels off the hook for serious war crimes, while proponents argue that any tampering could end up reigniting hostilities.

Outside a polling station in the Laureles neighborhood of conservative-leaning Medellín, Colombia's second-largest city, Duque's supporters were out in force.

"Duque is intelligent with a strong academic and professional background," said Franceline Morales Agudelo, 51, a business administrator. "He has everything required to be a good leader."

Duque had to shake off claims that he would be a puppet for Álvaro Uribe, the powerful ex-president and the Democratic Center's Senate leader.

Gustavo Arnavat, who served with Duque on the executive board at the IDB, said the accusations were unfair.

"Ivan is a thoughtful, eloquent and calm leader who has, indeed, received the strong support of Álvaro Uribe, among others in Colombia, but who has also proven his unique effectiveness as a leader in the Senate," Arnavat told NBC News.

Meanwhile, Petro, whose progressive agenda appealed to younger generations and those from lower socio-economic backgrounds, will be emboldened having reached the runoff stage — he is the first leftist to do so in Colombia's modern history.

Presidential candidate Gustavo Petro waves to supporters after casting his vote during the second round of presidential elections Sunday in Bogotá, Colombia. Luis Robayo / AFP - Getty Images

Petro, 58, who had to fight off claims from the right that he wanted to turn Colombia into another socialist Venezuela, had vowed to take on entrenched elites, tax unproductive landowners and reduce Colombia's dependence on fossil fuels.

Alejandro Montoya Valencia, 35, a graphic designer, said he voted for Petro because he felt unrepresented by Colombia's political class. "Politics and political actors in Colombia must change," he said.

Carlos Alberto Builes Tobón, a politics professor at the Pontifical Bolivarian University in Medellín, said Petro had widened the political debate.

"He's talking about big issues: inequality, the environment, society and how the economy is managed," Tobón said. "It's good that today we can talk about a left wing in Colombia."