SAN SALVADOR — Seven bus drivers are killed in four days. A morgue worker slowly counts 224 stab wounds on a murder victim. Police officers post memorials to slain comrades and photographs of “eliminated” suspects on Facebook.

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.