El Salvador is convulsed in violence at levels not seen since the civil war of the 1980s. Murder rates have soared while the government struggles to rein in the powerful criminal gangs that control neighborhoods in many of the country’s cities and towns.

In an offensive started at the beginning of the year — the latest front in a decades-long struggle to control crime — the police have pushed deep into the slums where gangs hold sway and three units of elite troops stand by to join the battle on the streets for the first time.

But the strategy has backfired, and the violence is intensifying.

In June, 677 people were murdered — twice as many as six months earlier — in a population of just over six million. About 300 gang members have been killed by the police this year.

The gangs, meanwhile, have killed about 50 police officers and soldiers. Although the murder rate dipped in July, gangs made a fearful show of force at the end of the month, when they ordered bus companies to halt service and paralyzed public transport in the capital, San Salvador. To drive home their demand, they killed seven bus drivers.

At the center of the conflict are the main gangs in El Salvador; Mara Salvatrucha, known as MS-13, and two factions of Barrio 18, which operate independently. Their foot soldiers battle for the smallest of spoils, killing each other, those who resist them and anybody who stumbles into the crossfire.

Their presence is everywhere in the neighborhoods where they sow fear. They extort shopkeepers and delivery trucks, they sell drugs, they drive those suspected of being informants from their homes and protect turf so fiercely that children living in one gang’s territory cannot cross into a rival’s to go to school.

In La Chacra, a slum of tiny concrete houses where shootouts among different gang factions resound almost daily, residents living on one side of a narrow traffic bridge over a trash-strewn riverbed cannot walk to the other, said Nancy Jaquelin Quijada, a resident. “People have left and the gangs come in and take over their houses,” she said.

The government crackdown is intended to expel gangs from these neighborhoods, and the police — as they surge into densely packed slums to round up suspects — are given free rein to shoot in self-defense under rules announced by the government.

“The engine of violence is now the conflict between the state and the gangs,” said Paolo Lüers, a columnist who helped negotiate a 2012 gang truce.

President Salvador Sánchez Cerén said in April that almost 30 percent of the killings in March involved gang members shot in skirmishes with the police.

Photo

El Salvador's murder rate has soared as police officers struggle to rein in powerful criminal gangs.Credit
Meridith Kohut for The New York Times

Although his crackdown is politically popular, a growing number of voices are beginning to warn against the abuses as innocent people are caught up in the police sweeps and reports emerge that police are killing gang suspects. Human rights violations in the crackdown “will lead us into a vicious circle from which it will be difficult to leave,” said the Jesuit-run Central American University in a recent editorial.

Mario Vega, an influential evangelical pastor, wrote in the daily El Diario de Hoy, “While the current government is the one that most consistently talks about preventing violence, in practice it is the most repressive government since the war.”

“The current government has taken repression to the level of excessive use of force, arbitrary detention and summary executions,” he wrote.

On the streets, officers argue that they need even more flexibility to confront gangs that are becoming better armed. “We are limited by human rights,” said Samuel Hernández, an officer on a recent night patrol.

To show what his days are like, he pulls out his phone to flick through pictures: the body of a teenager, shot by the police after he fired on them; another teenager, his head swaddled in bandages after a beating by rivals.

The gangs emerged after the 1992 peace agreement that ended the war between leftist guerrillas and the United States-backed military but failed to address the country’s deep-rooted inequality. Salvadoran gang leaders deported from Los Angeles brought criminal techniques to impoverished youths who found a means of survival in the gangs. Government crackdowns in the 2000s, known as “Iron Fist” and “Super Iron Fist,” failed to dismantle the gangs’ structures and succeeded only in increasing the violence.

“This is a problem that has been growing for years, that was never confronted at its birth and was allowed to grow practically without any clear policy,” said Héctor Dada, a former economy minister and legislator. “Now the dimension of violence in the country is enormous.”

Mr. Sánchez Cerén’s offensive is a decisive rejection of a truce that was tacitly approved by the previous government. The deal, which was reached with imprisoned gang leaders, cut homicide rates in half for 15 months until it began to break down about two years ago.

An error has occurred. Please try again later.

You are already subscribed to this email.

As part of that agreement, the government moved gang leaders to poorly guarded prisons where many continued to run their businesses by cellphone. That ended in February when the government returned the gang leaders to a maximum-security lockup and cut them off from their lieutenants.

“It is clear to us that the government is beating the drums of war,” said a gang leader who would identify himself only as Santiago. He attributed the violence to the move, which separated the leaders from the rest of the gang’s loosely organized structure and lifted all controls over violent local cells.

“The base is left like a family without its father,” he said in an interview. “We cannot mobilize the way we need to in order to reduce the homicides.”

Some analysts say that the previous government’s truce is responsible for the violence because it showed the gangs they could use it as a tool to back their political demands. Henry Campos, a law professor at the Central American University and a former security official, said the spike in murders is a tactic to force the government to negotiate.

Photo

Students at a school in in La Chacra, a slum where shootouts among different gang factions resound almost daily, worked on a social studies assignment about the benefits of seeking employment outside of El Salvador.Credit
Meridith Kohut for The New York Times

But in a handwritten letter smuggled out of the maximum-security prison and addressed to a citizens’ advisory group and the country’s justice minister, the gang leaders charged that the government’s recent crackdown “had increased gang violence disproportionately” and asked to open a dialogue with civil society organizations.

While San Salvador was crippled by the transport shutdown in July, Mr. Sánchez Cerén, a former guerrilla commander during the civil war, replied to the gang leaders. “I want to tell these murderers, these criminals, that they won’t break the will of the government and the Salvadoran people,” he said.

“At no time is our government prepared to negotiate with these criminals,” he added. “We are going to hunt them down, capture them and put them on trial.”

The government argues that the crackdown is part of a broader approach to improve education and job creation in the most violent communities, rehabilitate gang members, and strengthen the rule of law.

The strategy’s road map is an ambitious $2.1 billion plan developed with the help of the private sector, churches and aid groups.

But El Salvador’s limping economy cannot create the jobs that are needed to provide an alternative to the gangs. Growth has hovered around 2 percent for years. Remittances from Salvadorans working in the United States account for about 17 percent of national income, and half the work force toils in the informal economy.

“We can’t divorce security from economic reactivation,” said Rafael Pleitez, an economist who helped draw up the plan.

Where the money will come from is unclear. El Salvador’s tax collection is full of holes, and many in the conservative private sector would rather create their own charity initiatives than sign on to a vast program directed by a government led by former leftist guerrillas.

Mr. Lüers said that even if there were money, “these plans for social inclusion won’t work in a climate of conflict.”

That contradiction is playing out in Ilopango, a suburb on the rural edge of the capital where the loquacious mayor, Salvador Ruano, received masked gang leaders in his office two years ago to negotiate a local cease-fire.

Since then, Mr. Ruano has used his small budget and some international aid money to create jobs for gang members and their families and set up a few technical schools.

In past weeks, he had to shut down a bakery he set up for gang members after a police crackdown swept up some of the boys working there. The police burst into a tomato greenhouse and trampled the crop, ostensibly looking for guns. Only a modest chicken farm is still operating undisturbed, where teenagers in gang attire cup their hands gently to move tiny chicks under a heat lamp.

Others have questioned whether the government will keep its promises.

“As long as there is no political will to care about youth, this scourge will grow,” said Raquel Montoya, who works in gang neighborhoods and prisons for the evangelical San Andrés Foundation. “Everybody has opinions, but they don’t put anything into practice.”

Gene Palumbo contributed reporting.

A version of this article appears in print on August 12, 2015, on Page A4 of the New York edition with the headline: A Battle With Gangs Convulses El Salvador . Order Reprints|Today's Paper|Subscribe