AS THE balmy Sunday evening of August 5th wound down, the Chicago Police Department (CPD) was out in force on North Avenue Beach. Officers guarded the trendy Shore Club and watched Castaways, a beach bar shaped like a boat. The watering holes are often trouble spots during very hot weekends. It had already been a particularly brutal one, with the violence peaking early on Sunday, when 30 people were shot in a three-hour span between midnight and 3am.

By the end of the weekend 12 people had been shot dead, two children among them. Almost 60 were injured in shootings, of which two dozen were children. “We have a heavy heart,” said Rahm Emanuel, the mayor of Chicago, at a press conference on August 6th. “What happened this weekend did not happen in every neighbourhood in Chicago, but it is unacceptable to happen in any neighborhood in Chicago,” he said. The epidemic of shootings and killings tends to be confined to four or five neighbourhoods on the South and West sides of the city.

The bloodshed comes as Chicago’s epidemic of violent crime seemed to be abating at last, especially in some of the most murderous parts of the city. After 2016 turned out to be the deadliest year for two decades, with 762 murders and 3,550 shootings, the following year was less bloody, with 650 murders and 2,785 shootings. So far this year 318 people have been killed, 110 fewer than at this point last year. In some neighbourhoods the change for the better was remarkable. Englewood, a hard-up, predominantly black neighbourhood on the South Side, saw a decline in murders of 44% and a drop in shootings of 43% in 2017 compared with the previous year.

This carnage of the past weekend is a setback for Mr Emanuel, who is running for re-election in February. Crime is one of the reasons for his declining popularity among the city’s black voters, who represent around one-third of Chicago’s electorate. On August 2nd mostly black activists organised an anti-violence march on the North Side. They demanded the resignation of Mr Emanuel and Eddie Johnson, his police chief. In early July Father Michael Pfleger, the activist Catholic priest of St Sabina, a parish on the South Side, had led another anti-violence protest, which shut down one of the city’s major highways.

Mr Emanuel’s rivals for the mayor’s job wasted no time in attacking him for what they say is his failure to contain the violence. Paul Vallas, the former boss of Chicago Public Schools, lambasted the mayor for failing to keep the police staffed with enough detectives to solve murders and shootings. The CPD’s clearance rate of violent crime is one of the worst of big American cities; around four of five murders remain unresolved. As of the evening of August 6th the CPD had made no arrests connected to the weekend’s shootings. The former president of the police board, Lori Lightfoot, chimed in to declare that public safety is “the right of every Chicagoan—not a question of zip code or a commodity for the wealthy.” Garry McCarthy, a former boss of the CPD, whom Mr Emanuel sacked, mocked the mayor on Twitter and said a “state of emergency” should be declared in Chicago.

What caused the sudden spike in violence? The hot weather played a role, but not all steamy days lead to violence. Much of it was linked to conflicts between gangs, according the CPD. Gang members are using larger crowds as cover. “They shoot into a crowd, no matter who they hit,” said Fred Waller, chief of patrol of the CPD. The police also cited the high number of guns in circulation, the failure of courts and judges to convict those caught with illegal guns and the need for parents to instill the right values in their children. CPD leaders implored residents of the most violent neighborhoods to get in touch to help the police solve crimes, but trust between the CPD and poor blacks and Hispanics is scarce.

Rudy Giuliani, a former Republican mayor of New York and sidekick of President Donald Trump, blamed the problem on Chicago’s longtime “Democratic rule” in a series of tweets. Reiterating his support for Garry McCarthy (whom he called "Jerry" and a "policing genius”) he claimed that the former CPD boss can do a lot better than Mr Emanuel (whose name he also misspelt) who he said was “fiddling while Chicago burns”. Mr Giuliani also falsely claimed that Chicago had “63 murders this weekend”.

Mr McCarthy, a Democrat who is also running for mayor, could have done without Mr Giuliani’s endorsement “I am a proud Democrat and I do not agree with Mayor Giuliani’s political views,” he said in a statement. Meanwhile Mr Emanuel remained silent about his opponents’ attempt to gain political capital from tragedy. He knows that violent crime, police reform, the poor state of some public schools and high property taxes will dominate the mayoral election. And although he is still the favourite to win, his career too could fall victim to the city’s endemic violence.