Though San Salvador’s Mercado Central is statistically one of the most dangerous areas of one of the most dangerous cities in the world, an outsider wouldn’t know it just by walking through. It is, admittedly, congested, stretching across a few dozen blocks that throb with tens of thousands of vendors, clogging the roads with makeshift stalls and tables. Women hawk tamales and bags of cut papaya, or ladle steaming coffee into flimsy polystyrene cups that buckle from the heat. Boys push wheelbarrows of ice water, bananas, and mangoes past rows of mannequins modelling cheap leggings. This is one-stop shopping at its most frenetic. Life and commerce thrum. Violence here is largely invisible – until, of course, it isn’t.

San Salvador is both the political and homicide capital of El Salvador, a country where, since 2014, the number of murders has surged after the unravelling of a two-year-old gang truce. Gangs have been running Mercado Central for years. According to Salvadoran journalist Óscar Martínez, in a 2015 report on the swelling of violence in the city centre, they tell vendors “where they will sell, how much they will pay for the space to sell … Sometimes they even tell them who to vote for.” Gangs come to the market to recruit children to join their ranks, or to collect renta – a euphemism for protection money – from vendors and stores, or to menace and, when they deem it necessary, to kill.

In response, San Salvador’s young mayor, Nayib Bukele, is attempting to solve the problem of this rag-tag market, in part, by dismantling it. It is an ambitious project for Bukele, an upstart politician who, at 33, and with just three years of experience in public service, won the most important mayoral seat in the country in 2015.

Previous mayors have attempted to physically remove unregistered vendors from Mercado Central, which led to rioting. Bukele’s strategy is to entice them to move by building new markets just outside the city centre (construction is slated to be completed by 2018). Instead of haggling from makeshift stalls in the middle of pavements and roads, his plan would allow vendors to operate through leases, in safe and sanitary conditions.

The plan, known as the reordenamiento (reordering), also calls for the revitalisation of the city centre, where the country’s oldest and most majestic buildings – including the city’s main cathedral and national theatre – stand in disrepair, nearly forgotten. Such an aggressive embrace of gentrification is Bukele’s way of addressing a fundamental disconnect between the rich and poor in Salvadoran culture, which he sees as one of the root causes of the country’s violence. If you know your neighbours, Bukele believes, you won’t try to kill one another.

Predictably, almost every vendor I spoke with at Mercado Central in January, less than eight months after Bukele had assumed office, resented the plan. “We won’t move,” an elderly woman declared from behind her tables stacked with bars of soap and children’s toys. “It is our right to be here,” she said. “If we have to, we will fight to stay!”

“Nayib cannot make us move!” someone else shouted.

“Oh, they’ll move,” Bukele told me a few days after my visit to the market. “They’ll want to move. They’ll pick up their own umbrellas and walk to the new market themselves.” He paused, then cracked a smile. “And we’re going to film it.”

That someone of Bukele’s profile and limited political experience could gain control of a capital city is a sign of how impatient Salvadorans are with the status quo. Though El Salvador is about the size of Wales and comprises less than 14% of the population of Central America, it accounts for more than 35% of the region’s homicides, nearly all of which go unpunished. Disenchantment with the country’s two major parties runs deep. Bukele’s party, the leftist Farabundo Martí National Liberation Front (FMLN), began as a group of guerrilla revolutionaries during the country’s civil war, which lasted from 1980 to 1992, but its leaders have lost their populist edge and the party is now widely seen as having sold out. Meanwhile, the conservative Nationalist Republican Alliance (Arena), which controlled the government of wartime El Salvador, is seen as the corrupt guardian of the elites’ wealth.

Bukele, by contrast, is met with the fanfare and admiration of celebrity. In the past year, while reporting on the violence in El Salvador and the exodus of citizens that it has unleashed, I’ve heard Bukele’s name – Nayib, Nayib, Nayib – issued like a trumpet call, from schoolyards in Oakland, California, to cornfields in El Salvador’s sun-parched east. Even those who oppose his policies concede that he is making profound changes, and thus, at worst, speak of him with respect.

In 2015, there were 104.2 murders per 100,000 people in El Salvador. In 2014, the US averaged five homicides per 100,000

Popularity may not be the remedy for a social crisis, but it is at least a galvanising force – and, in El Salvador’s case, a timely one. Nearly 25 years after a catastrophic civil war, which left more than 75,000 people dead, El Salvador is now effectively at war again. The country’s three main gangs – MS-13, Barrio 18, and the 18th Street Revolucionarios – control most towns and cities, battling over territory, while making money from small-time drug deals and extorting businesses and locals. To disrespect a gang member, or neglect to pay rent, or pass into a rival gang’s zone, is to risk death.

Following the collapse of the gang truce, prisons are now at 325% of intended capacity. Even tiny holding cells, meant for temporary confinement, are crammed with suspected criminals who spend months if not years awaiting trial. Police patrols are on the rise, and several illicit killings of suspected gang members have been exposed by a dogged local press, who risk retribution from both the police and the gangs. In 2015, a total of 6,640 Salvadorans were murdered – an average of 104.2 murders per 100,000 inhabitants. (By comparison, in 2014, the US averaged five homicides per 100,000.) More than 3,000 people were murdered in the first six months of 2016 – up 7% from last year.

Arrested gang members in San Salvador. Photograph: The Washington Post/Getty Images

Yet when I met Bukele in his office in January, he skirted the subject of violence, preferring to discuss the projects he had launched. “Look,” he explained when I pressed him. “If you have a headache, what would you take? A Tylenol. But what you have isn’t a Tylenol deficiency. You are stressed, or you are dehydrated, or something more severe. So you take two, and then that doesn’t work, and you take four, and then 10.” La violencia was a symptom of a more troubling disease, he argued, rooted in El Salvador’s longstanding poverty and structural injustice. Though he was stating relatively basic principles of economic development, El Salvador is so mired in violence that, at present, few policy-makers are discussing the situation in these terms.

Finally, lest there be any confusion, he drove the metaphor home. “Here, Tylenol is the police. People want more police, and I understand. It’s dangerous here – they have a headache, they want the Tylenol. But that won’t solve the problem.”

At first glance, Bukele’s efforts – a pop-up museum in the city centre, reorganising the Mercado Central to offer walking paths and artists’ studios, promoting skateboarding as a positive activity for the city’s youth – seem like the unstudied pet projects of a starry-eyed rich kid. And it is true that Bukele believes that if you remove structural inequities, peace and prosperity will follow. But to do this requires not just money – Haiti, he points out, is still languishing in poverty despite having received several billion dollars in aid since the earthquake that devastated the country in 2010.

More important is what Bukele calls his “hidden project of inspiration”, the degree to which he can convince Salvadorans that their country has the potential for greatness. In Bukele’s estimation, projects such as the city-centre revitalisation do not just alter the physical reality of the city, but the relationship between citizens and the place they call home – and, by extension, their relationship with one another.

Bukele’s entry into politics was something of a surprise. Born more or less the boy prince of a wealthy and well-respected Salvadoran family, he seemed destined to join their business empire. After graduating from high school in the late 1990s, Bukele started working with his family’s public relations firm, Brand Nolck Publicidad, which had recently signed on a high-profile client: the FMLN. Following the end of the country’s civil war, in 1992, the FMLN was transitioning from a guerrilla movement into a legitimate political party, and sought to rebrand itself as a progressive, ideas-driven organisation that had divorced itself from militant tactics. Bukele was assigned to the account.

For him, it was a political awakening. “It showed me the reality of my country,” Bukele told me. “It represented the people’s fight for justice.” Over the next few years, he enjoyed plenty of success – in public relations, working with his family’s restaurant empire, and organising a vibrant concert series in the capital. But eventually Bukele grew restless, feeling what he describes as a moral imperative to try to fix social injustice in El Salvador. In 2009, for the first time, an FNLM candidate – Mauricio Funes – was elected as president. In 2011, at the age of 29, Bukele left the business sector for a life in public office, as a mayoral candidate for his former client.

Bukele was running in Nuevo Cuscatlán, a small town on the outskirts of the capital, whose elites (the Bukeles among them) resided in hilltop mansions, while the rest of the population lived in poverty below. Nuevo Cuscatlán was a longtime Arena stronghold, but giving a low-stakes candidacy to a young political arriviste such as Bukele carried little risk for the FMLN. His campaign would cost the party nothing, because he could finance it himself. Plus, Bukele would add a youthful, entrepreneurial edge to the party – a boon for a political organisation dominated by ageing former guerrillas.

Since his early days, Bukele’s appeal has stemmed from his commitment to his own creation – the Nayib Bukele brand

Bukele’s platform was to change living conditions for the poor, promising better education, healthcare, access to water, and public utilities. And while his popularity grew, he kept polling poorly. The fact that the city’s most needy were staunchly behind Arena – a party that he felt favoured the wealthy – infuriated him. Bukele began berating his audiences during campaign talks and meetings. His general message was: If you continue to vote for a party that does not support your interests, you can’t complain if things do not get better. It seemed like campaign suicide. And yet people rallied around the message. In March 2012, Bukele edged out the incumbent mayor Álvaro Rodríguez of Arena by less than 2% of the vote.

Since his early days in politics, Bukele’s appeal has stemmed from his commitment to his own creation – namely, the Nayib Bukele brand. In San Salvador today, his cerulean signs, emblazoned with slogans – “New ideas are invincible”; “Your city works for you” – adorn the city like flags. Six months into his tenure, he redesigned San Salvador’s seal, which he now wears pinned to his jacket. Reminders of his influence mark the city like a kind of municipal graffiti.

Few seem to scoff at his enthusiastic self-promotion. Unlike the civil-war years, when political allegiances were often motivated by fear, Bukele’s fans adore him freely, emboldened, perhaps, by the feeling that they are choosing someone who does not appear confined by political tradition. In fact, he has long since become disenchanted with his own party, the FMLN, and is outspokenly critical of its leadership. This only increases his popularity and the sense that he operates according to his own principles.

Along the way, Bukele has picked up a few enemies. San Salvador’s two most popular print newspapers – La Prensa Grafica and El Diaro de Hoy – seldom run stories about Bukele’s projects, leaning instead towards criticism and scandal. They have claimed that Bukele’s family receives federal contracts because of his influence on the party leadership, although he denies this, and that he makes nepotistic appointments to government posts. (In early September, Bukele was sanctioned by the Government Ethics Tribunal for appointing his brother, Yamil, to an unpaid post as the president of the Municipal Institute of Sports.)

As a result, Bukele has turned to social media to publicise his work. He is known for Instagram posts that range from irreverent (an ongoing series depicting his flamboyant socks) to deeply reverential (a photograph of San Salvador’s historic centre lit up at night). His Facebook feed, meanwhile, is supplemented by a team of photographers that buzz around him, documenting his every move.

Nayib Bukele is fond of Instagramming his socks. Photograph: Instagram

Ironically, Bukele’s popularity has begun to cast a shadow over his own party. In 2015, he publicly announced that if the FMLN reappointed the country’s attorney general, Luis Martínez, whom Nayib considers “a gangster, very corrupt, the worst of the worst”, he would abandon the party. Within days, the FMLN acquiesced, replacing Martínez with a new attorney general. (In August Martínez was arrested and found guilty of tampering with investigations and “procedural fraud”, for which he was fined. In late September, he was arrested again in relation to another corruption scandal, although he denies all charges.) “It was a bluff,” Bukele admitted, but one that worked.

Bukele’s power is based on a form of leftwing populism that has deep roots in El Salvador. He relies on being loved by rich and poor alike, on urban and rural voters, on the old and young. To lose the votes of all the vendors at Mercado Central would not necessarily ruin his political career – there aren’t enough of them to sway an election – but it could end up making him seem like a rich man with big ideas, who is no real friend to the poor.

Bukele claims that his projects, however giddy, are at their core intended to improve the lives of San Salvador’s most needy. In January, he launched a public works initiative named San Salvador 100% Illuminado, the premise of which was simple. “We will have a light on every corner of San Salvador,” Bukele promised the week before the project broke ground. Part of the intention was to improve security in the city’s worst areas, but Bukele also said that he wanted Salvadorans to be able to boast that their city – like New York, like Paris – was a city of lights, the cosmopolitan heart of a country, a city brimming with potential.

“You can call it PR if you want to be a little cynical,” he said. “But I’m talking about inspiration. PR is important. I have PR. But that is something earthly. I’m talking about something sublime.”

In early 2016, as Bukele continued to carry out his project of inspiration – lighting up street corners and fixing potholes, Instagramming his socks and high-fiving kids on the streets – the federal government deepened its crackdown on El Salvador’s gangs.

The previous summer, the 18th Street Revolucionarios had effectively shut down most of the country’s bus system, assassinating eight bus drivers and two civilians, and threatening to kill any drivers who went to work. The attacks were widely understood as a show of strength in response to the government crackdown on gangs. In response, El Salvador’s supreme court declared all Salvadoran gangs terrorist organisations, thus increasing the prosecutorial power against them. A state of emergency was declared at several of the country’s high-security facilities, and the prison regime – which had allowed many gang members easy access to mobile phones, conjugal visits and other perks – was tightened. President Sánchez Cerén announced the formation of a rapid-response police team to directly combat gang activity, and judges began to issue prison sentences to gang members of up to 200 years.

In March 2016, in a video announcement posted online, a masked gang member of unidentified allegiance announced that the leaders of all three of El Salvador’s main gangs were asking their members to temporarily stand down, in order to show the government that its “extraordinary measures” were unnecessary. Within a month of the video’s release, the country’s murder rate dropped from 611 per month to 353, and has held at around 350, or lower, each month since. The gangs’ ceasefire seemed to be an invitation to the government to negotiate. But according to the President Cerén, that option was not on the table.

By June, government forces had killed 346 gang members; conversely, according to estimates from the investigative organisation Insight Crime, only 16 officers were killed during that same period. This was the Salvadoran government’s third incarnation of an anti-gang policy, known as the mano dura (iron fist). The programme dates back to 2003, when President Francisco Flores, of the Arena party, wanted to project a tough-on-crime image, despite gang violence being relatively limited at the time. In 2006, President Antonia Saca of the Arena party doubled down with his own version, which he called super mano dura. Bukele sarcastically refers to this current incarnation as the “super super mano dura,” pointing out that with each campaign the violence has only worsened, and the trauma to the country only deepened.

“It’s never worked in the history of humanity,” he said of such heavy-handed tactics. “Why would it work in El Salvador? They don’t even have the money to pay for it. It might lower [murder] rates for a while, but it will come back to haunt us.”

Bukele considers the reinstatement of mano dura to be a war against youth – in particular poor youth, who are often arrested for agrupación illícita, or illegal congregation. The law allows officials to arrest groups of three or more individuals, who they believe have some kind of official structure and intend to commit crime. In other words, they can arrest any bunch of kids on the mere suspicion of being up to no good. This “crime” carries a punishment of three to five years in prison.

Young people are fleeing El Salvador in great numbers. Between October of 2015 and September of 2016 alone, US immigration authorities apprehended 39,884 children and families from El Salvador who were attempting to enter the country. “Who goes?” Bukele asked when we talked about the Salvadoran exodus. “Little kids don’t go. Old people don’t go. It’s young people. Strong people, people who can work, who can produce.”

El Salvador is home to 6.34 million people, but according to a Pew Research Center study, nearly two million Salvadoran immigrants and their children resided in the United States in 2013. While the country’s exports totalled $5.3bn in 2014, the total from foreign remittances in 2015 – nearly all of which come from the US – was $4.3bn, up $125m from the year before.

In February, I visited a migrant shelter for youth in Reynosa, Mexico, just across the border from Texas. The day I was there, the shelter housed about 25 teenagers. Six of them were Mexican and had recently been deported from the US, but the rest were from Central America. Among them, seven adolescent boys from El Salvador were waiting to be sent home, and they all told me the same thing: once they got back, they’d rest for a while, hang out with their families, then head north all over again.

The kids were seated at folding tables in the spacious recreation room. The day’s activity was music, and an older man energetically strummed his guitar, urging the boys and girls to sing along while they played rounds of Uno. Occasionally, a few of the kids chimed in or lazily shook a maraca. Though none of the Salvadoran boys in the shelter were from the capital city, they had all heard of Bukele. Their eyes widened when I mentioned his name.

“Nayib!” a boy with sagging basketball shorts cheered. “He’s cool.” He slapped an Uno card down on the table and spat an orange pip on to the floor. “He really cares about young people.”

A few months later, I mentioned this moment to Bukele, adding that every young Salvadoran I had spoken to seemed to adore him. “Too bad they don’t vote,” he said.

By May, the illumination of San Salvador was complete, and city workers had begun to disassemble several blocks of the Mercado Central. Bukele’s team posted a video of the efforts, titled “A Historic Success”, set to an inspirational score, on his YouTube channel. The camera pans across crowds of assembled municipal workers, across reordered streets, across new market stalls with the cathedral and national theatre standing majestically in the background. The shot approaches Bukele, who faces away from the camera, in the moments before a major public address on the steps of the Palacio Nacional. Cut to the workers, to the city. We never actually see the mayor’s face. On the surface, it is an act of humility, but it is also a smart move, hinting at Nayib’s presence behind all this, as he triumphantly surveys all the good work that no one else thought was possible.

Picture of San Salvador’s lights from Nayib Bukele’s Instagram account. Photograph: Pic from Nayib Bukele Instagram account/Nayib Bukele/Instagram

In reality, not everyone was happy. On a dusty side street adjacent to the Mercado Central, where stalls once spread across a handful of city blocks, a phone vendor named Eric Canales was setting up his new shop amid screeching saws and the chaos of construction. Canales told me he had been promised that city workers would help people like him move. Instead, he had to scramble help from friends and family. He claimed that the government workers were asking for bribes to connect electricity and to help the merchants relocate. The move had cost him two weeks of business, and his regular customers now no longer knew where to find him.

“We lost our rhythm of sales,” he told me amid the hammering. Sparks fell on to his ledger and he brushed them away. The space he was given was, he estimated, about half the size of his previous space. This was only a temporary relocation; when the promised new, state-of-the-art markets were finally completed, he would be asked to move again. As far as Canales was concerned, the reordering of the city centre was for the benefit of bigger businesses. Vendors like him were mostly on their own.

In late June, a few weeks after I last met with Bukele, a security camera caught footage of a group of men stealing the city’s newly installed streetlights in broad daylight. According to the next days’ edition of the Salvadoran news blog Ultima Hora SV, 53 lights had been stolen from the San Salvador 100% Illuminado project. “I knew it,” a Salvadoran friend told me. “Anything you try here,” she said, “will fail.”

Nonetheless, Bukele continues to project the idea that anything is possible, that the city’s real problem is its deeply rooted cynicism. And considering Bukele’s popularity and ambition, it appears almost a given – despite his insistence otherwise – that he will run for president in 2019.

Where does his optimism come from? It seems wrapped up in the FMLN’s origin story, in which guerillas appealed to ordinary Salvadorans through moralistic messages and rousing songs. “I never have understood how a group with few resources – no media, with no social networks – inspired thousands, almost a third or half of the country. With a guitar? With a song? I haven’t figured it out.” Bukele shook his head. “But it’s big.”

Even if many of the FMLN have abandoned the idealism that shaped the movement, Bukele claimed, at the party’s core, these values persisted. What his team was doing in San Salvador was “a modern exercise in inspiration. We’re trying to inspire again, like the guerrillas did with a guitar and a song.” He paused. “We’re not heroes,” he said. “But we have better guitars.”

Main Photograph: Juan Carlos/Virginia Quarterly Review

This article is adapted from an essay published in the autumn 2016 issue of the Virginia Quarterly Review. Reporting for this story was supported by a grant from the Pulitzer Center on Crisis Reporting.

• Follow the Long Read on Twitter at @gdnlongread, or sign up to the long read weekly email here.