As drinkers watched the final minutes of the Barcelona versus Manchester City football match in the Vår bar in Gothenburg on Wednesday night, all hell broke loose. Two masked men opened fire with automatic weapons, killing two and injuring a dozen more. The city hospital pleaded for blood donors to come forward as it struggled to save the wounded.

Petar Petrovic, 20, a Swede of Serbian origin, died in the storm of bullets. A DJ at the bar, he was due to start university in London this year.

The other dead man, aged 25, was a leading figure in a local gang, the Vårvädersligan, named after the square where the shootings took place. With a string of convictions, including drug offences, he had only recently left jail, according to press reports. Police declined to confirm or deny any details about the man.

Sweden has been shocked by the barbarity and indiscriminate nature of the Gothenburg shootings. Gang violence has featured occasionally in local news, but this was the first time an innocent bystander had been killed. Regional police chief Klas Friberg called it a “heartless attack with no human feeling”.

The tragedy has also shone a spotlight on a hidden aspect of Swedish society that reads like the sub-plot of a Stieg Larsson novel, in which poverty, racism and segregation are driving young men from immigrant backgrounds into gangs and gun crime.

A few days before the shooting, police had arrested another member of the gang after he was observed in a railway station handing over a shoebox stuffed with 500,000 krona (£39,000). A third figure in the gang had left the Vår bar shortly before the shooting took place.

Regional police chief Klas Friberg speaks during a news conference in Gothenburg on Thursday. Photograph: Adam Ihse/AFP/Getty Images

The killings broke a nine-month period of relative calm in Gothenburg. After a double murder in early 2013, police poured resources into Biskopsgården, the deprived borough where Wednesday’s killings took place, which has high levels of recent immigration and overcrowding. Entitled operation Safe Gothenburg, the police targeted nine gangs across the city involved in turf wars over drugs, weapons and contraband.

They confiscated 200 firearms, including 50 machine-guns, and 30kg of plastic explosives. After 57 shooting incidents and eight fatalities in 2013, there were four deaths last year, while arrests led to the jailing of key gang leaders. The trend seemed to be clear.

In December, a dozen members of the Bergsjö gang were jailed and only last month, the leader of Bulls motorcycle gang started a 10-year sentence for violence. He had an earlier conviction for “crucifying” a man by strapping his wrists to a plank and leaving him hanging.

However, fears of a flare-up of gang crime lingered when the leader of the Bandidos gang was released from jail last summer after a seven-year sentence for a bomb attack.

“We have groups that are really marginalised, cut off from mainstream society, dropouts with no work,” says Sven-Åke Lindgren, professor of sociology at Gothenburg university who last year authored a report on gang crime. He sees Wednesday’s attack as a show of power in a battle for supremacy between gangs.

“These are ‘radical losers’, more desperate, more angry and frustrated, who are prepared to use weapons and violence that is really shocking to Swedish society, to compensate for their loss of status,” Prof Lindgren said.

Gang crime is not confined to Gothenburg – 22 Swedish cities are affected, said Magnus Lindgren of the Safer Sweden Foundation. This is a “new Sweden”, he said, which means new methods of crime fighting are needed.

I love this area, but we have a problem with young people feeling they can’t share the aspirations of the majority

“The main problem is the Swedish model of crime prevention which dates from the 1960s, trying to build a good society with good education and child care. That’s all very well, but we are fighting the crimes of yesterday, not necessarily the crimes of today or tomorrow.”

Friberg, the police chief, said police were working “to do as much harm to the individual criminals as we can” while trying to halt the trade in illegal weapons. Interior minister Anders Ygeman called for a doubling of sentences for gun crime.

In Biskopsgården on Friday, small groups of people came to lay flowers in front of the Vårs bar in the middle of a small shopping precinct. There was also a sense of fear – the library was quiet because parents had kept their children at home, locals said.

“This is a ghetto,” said Nora, 25, who was born of Saudi parents who moved to Biskopsgården when she was just a few months old. “There is racism and young people can’t get jobs; they feel they have no future in Swedish society.”

Now studying to be a nurse, she is worried what may happen to her brother, aged 10, when he gets a little older. “The gangs make boys feel like family, they look after them,” she said. She wants her brother to go to a school outside the borough where there is no drug dealing.

Katarina Despotovic, a researcher who has chronicled what she calls the neglect of boroughs such as Biskopsgården, said Gothenburg was concentrating resources in the city centre, creating suburban satellites “that no one cares about”.

“I love this area and its people, but we have a problem with young people feeling they can’t share the dreams and aspirations of the majority,” said Ulrika Stöök, 45, who works for the local council in Biskopsgården.

“We need to give young people hope. We can do a few things locally but now we need help.”

On Friday night, the two killers were still at large.