Nayib Bukele and his wife, Gabriela de Bukele, wave to supporters after the first official presidential election results were released in San Salvador on Sunday. (Jose Cabezas/Reuters)

IF ANY country can be said to have suffered enough, it would surely be El Salvador, the tiny nation of 6.4 million people on the Pacific coast of Central America. It has a long history of inequality and violence, the ugliest chapter of which occurred during the 1980s, when a civil war between a U.S.-backed government army and Cuban-supported guerrillas claimed tens of thousands of lives. Hundreds of thousands of Salvadorans went north to escape human rights violations and poverty. The Salvadoran American community, 2 million strong, is now the third-largest Hispanic-origin group in the United States. The northbound flow continues, as entire families continue to seek refuge here from gang violence that produced a murder rate — 50 per 100,000 inhabitants in 2018 — 10 times worse than that of the United States.

It therefore should not be surprising that the Salvadoran people would eventually cast out parties and politicians, rooted in the factions that waged the three-decade-old civil war, that have alternated in power since a 1992 peace settlement. In Sunday’s presidential election, voters rejected candidates of the right-wing Arena party and the left-wing FMLN in favor of an independent, Nayib Bukele , 37, who has the twin distinction of being both the youngest to be elected president in El Salvador’s modern history and the first of Muslim origin. Mr. Bukele won 54 percent of the vote running on a vague, populist, anti-corruption platform, which made political sense because the last Arena president is now serving 10 years in prison for embezzlement and an FMLN predecessor fled to Nicaragua rather than face charges of stealing hundreds of thousands of dollars.

Official corruption is the Salvadoran electorate’s perennial grievance, yet it may not be their most urgent issue. That would be criminal violence, specifically the murderous activities of MS-13 and other extortion rackets, which are infecting all levels of the society, spreading fear and sapping people’s will to engage in honest, productive activity. Past governments have tried cracking down, and they have tried negotiated truces — nothing, so far, has managed to eradicate the gangs and pacify society. The United States can help by extending the temporary residence in this country of Salvadorans obliged to settle here after another of their country’s occasional disasters: a 2001 earthquake. Their remittances back home help float the economy.

A nonideological outsider with a flair for social media, Mr. Bukele has shown some troubling tendencies to make unrealistic promises and dodge press scrutiny; he has also been refreshingly willing to question his country’s close ties with a major font of transnational crime — Venezuela. The real test of his presidency will be its ability to translate electoral victory into focused, pragmatic governance. In his last job, mayor of San Salvador, Mr. Bukele impressed citizens by organizing the beautification and reconstruction of the city’s historic center. That job was easy, though, by comparison with the task of establishing, at long last, a stable, legitimate national political order. Exhausted and disillusioned with the political options of the past, Salvadorans have deposited their hopes in Mr. Bukele. For now, all of El Salvador’s friends must do the same.