The two attacks, hours apart, killed 27 people and have intensified concern about gang-related armed violence across South Africa. Seventeen people died in an attack at a bar near Johannesburg on Saturday evening, and a further 10 were killed outside an entertainment venue in a township near Cape Town in the early hours of Sunday.

Police said eight gunmen entered the Johannesburg bar, opened fire on customers outside before moving inside, and set fire to two vehicles as they left. Fifteen people were injured in that incident. Authorities identified the dead as 13 men and four women, and said the motive was not clear.

In the Cape Town-area attack, five victims died at the scene and five more later died in hospital, while 11 people were injured. No arrests had been made in either case on Sunday morning, police reported.

The shootings follow another mass attack days earlier in Durban, where gunmen stormed a house in the KwaMakhutha township and killed 11 people. That sequence of incidents has fuelled fears that a recent spike in mass shootings may represent a deepening of the country’s long-running violence problem.

South Africa records roughly 60 murders a day in a population of about 62 million, a level of homicide that ranks among the highest worldwide. Illegal firearms are widespread, and recent mass attacks are frequently linked to turf wars between gangs involved in drug trafficking and illegal mining.

President Cyril Ramaphosa has warned of the scale of the threat from organised crime, calling it "the most immediate threat to our democracy, our society and our economic development". Earlier this year the military was deployed alongside police in areas with the highest murder rates, part of a broader effort to reduce armed violence.

Investigations into both weekend shootings were under way on Sunday, but with no arrests and no stated motive authorities face mounting pressure to explain how groups of attackers were able to stage such killings. The incidents are likely to increase scrutiny of current security measures and of efforts to tackle illegal weapons and gang networks.