After several days of uncertainty about El Salvador’s razor-close presidential election, guerrilla commander-turned-politician Salvador Sánchez Cerén emerged victorious this week, amid allegations by the opposition of fraud and foul play that were largely discounted by election observers.

The nation’s electoral tribunal announced final results early Thursday that gave Sánchez Cerén a win by the slimmest of margins — 6,300 votes out of nearly 3 million cast. But conservative candidate Norman Quijano and his supporters have yet to concede, and legal challenges will probably spill into next week.

For now, the victory is a validation for El Salvador’s ruling leftist political party, the Farabundo Martí National Liberation Front (FMLN), which emerged from the rebel movement in the country’s civil war in the 1980s and ’90s. Sánchez Cerén served as vice president for the current leader and campaigned on a pledge to deepen his predecessor’s popular social spending programs aimed at combating the vast inequality in the country.

That formula has been a winning one for leftist candidates across Latin America. And politicians whose formative years included armed resistance to U.S.-backed governments and military dictatorships have enjoyed success across the region. Brazil’s president, Dilma Rousseff, was jailed in the early 1970s as a member of a guerrilla group resisting the military dictatorship. Uruguay’s leader José “Pepe” Mujica was shot by police and imprisoned for years for his involvement with the Tupamaro guerrilla movement in the 1960s. Chile’s President Michelle Bachelet, newly elected to a second term, had been imprisoned by Augusto Pinochet’s dictatorship and endured threats and abuse.

A carpenter’s son, Sánchez Cerén rose to prominence as a teachers union activist and then top military commander for the FMLN during El Salvador’s 12-year civil war. He later became a legislator and then vice president for Mauricio Funes, a former journalist who was elected in 2009.

His opponents in the conservative ARENA party have sought to cast him as a leftist in the mold of Venezuela’s Hugo Chávez, and television ads during the campaign warned of chaos and violence if he were elected. But he denied he wanted to emulate Venezuelan policies and has positioned himself more to the center. Regional observers predict that he will want to keep close ties with the United States, where more than 1 million Salvadorans live. Sánchez Cerén said he aspires to be more like Uruguay’s President José Mujica, who lives humbly and gives most of his salary to charity.

The aftermath of Sunday’s vote has tested El Salvador’s electoral institutions. Quijano, mayor of San Salvador, and his supporters alleged fraud and foul play but have yet to present evidence. Quijano has taken a belligerent tone, claiming that there has been “massive electoral fraud” and that his supporters were on a “war footing.” He raised the possibility that the army might need to intervene, but military officials were quick to discount that and said they would respect the work of the electoral tribunal.

Quijano’s latest allegation has been that 20,000 votes were ­double-counted, accusing FMLN-allied polling officials of voting where they worked and where they lived. An FMLN spokesman called the accusations “unfounded” on Salvadoran television.

Quijano has also called on the “international community” to denounce the electoral fraud. But the U.S. Embassy, the United Nations and other international observers have supported the process.

“There was absolutely no reason to think there was any kind of institutional fraud whatsoever,” said Alexis Stoumbelis, executive director of the Committee in Solidarity with the People of El Salvador (CISPES), which had 35 people observing the election. In the organization’s 20 years of observing elections in El Salvador, she said, this year’s electoral tribunal has been “the most transparent and accountable that we’ve ever seen.”

There are more than 10,000 voting stations in the country. Representatives from both parties watch the process and agree on how many votes were cast at each station. The electoral tribunal spent the past days going over paperwork from each of these stations to ensure that the tallies were transferred accurately into the computer system. From preliminary to final results, the totals changed just a few hundred votes.

“ARENA hasn’t been able to show fraud,” said Roberto Rubio, executive director of the Salvadoran think tank National Foundation for Development.

Rubio, who is also an El Salvador representative for Transparency International, said he agreed with the demands of Quijano’s supporters to open the ballot boxes and do a more thorough recount, even if it extends the period of uncertainty. He said he believed that it would bolster the legitimacy of whoever ends up as president and make the process “as transparent as possible.”

But other observers think that these are just cynical attempts by Quijano’s team to buy time for further challenges and that the election process needs to end. The University of Central America observer team issued a statement saying the ARENA leadership has “recklessly and irresponsibly adopted a confrontational position and attitude.”

“It is incorrect to obey the law only when it favors one’s interests,” the statement said, “and to refuse to recognize it when it does not.”