Prosecutors on Monday charged a 40-year-old Swede with three counts of murder and 12 counts of attempted murder in a string of shootings that spread fear among immigrants in the southern city of Malmo.
The suspect, Peter Mangs, has been jailed since his arrest in November 2010, following a manhunt for a serial gunman police had linked to more than a dozen shootings in 2009 and 2010. After the arrest, investigators also linked Mangs to two murders in 2003.
Mangs denies the charges.
Most of the victims had immigrant backgrounds, but chief prosecutor Solveig Wollstad said the motive wasn't clear-cut.
In material seized on Mangs' computer and smartphone, "there was a certain measure of xenophobia," Wollstad told reporters in Malmo. "But there were also other things, for example an aggressiveness against people who had earlier been involved in crimes."
The shootings spread jitters in Malmo, Sweden's third largest city and one of its most diverse. Forty percent of the city's 300,000 residents are first- or second-generation immigrants.
Swedish media drew parallels to a racist gunman who hunted down immigrants in Stockholm in the 1990s. After evading capture for nearly a year, John Ausonius was convicted of one murder and nine attempted murders and is now serving a life sentence.
Comparisons have also been made between the Malmo shootings and the bomb-and-shooting massacre that killed 77 people in Norway last July, including by the right-wing extremist who admitted those attacks, Anders Behring Breivik.
As his terror trial began in Norway three weeks ago, Breivik mentioned Mangs and a group of German neo-Nazis as examples of "patriots" taking up arms to fight multiculturalism in Europe.
Investigators say the cases are not linked.
Police said Mangs used a Glock pistol in the shootings, but with different barrels in an apparent attempt to make it harder for police to trace the bullets to the same gun. The victims were shot through widows of apartments and businesses, in parked cars or as they were walking on the street.
Police inspector Borje Sjoholm said the gunman was initially difficult to track down because the victims were not connected to each other or the suspect. Many were shot at a distance, often at night, and there were only vague descriptions of the gunman.
Mangs was arrested following a tip-off from the public. Prosecutors said their proof includes forensic evidence, witness accounts and material seized from Mangs' home.
On Oct. 10 last year, a 21-year-old convicted drug smuggler on furlough from prison was shot in the head in a parked car. He was shot in the head but survived. A 20-year-old woman sitting next him was hit in the head and died.
The trial is set to start next week.