STOCKHOLM — A prosecutor on Wednesday closed an investigation into a police shooting that triggered riots in Stockholm's suburbs, saying no crime was committed and that the officer who shot a 69-year-old knife-wielding man acted in self-defense.

The shooting set off a week of violence in Husby and other low-income, predominantly immigrant areas of the Swedish capital in May. Youths hurled rocks at police and torched cars and buildings, resulting in 220 reported crimes and some 60 detentions.

The violence laid bare the frustration of many young people in those suburbs, where unemployment is high and many feel isolated and shut out from Sweden's prosperity. Some 80 percent of the roughly 11,000 people living in Husby, for instance, are first or second generation immigrants with roots in places such as Iraq, Somalia, the former Yugoslavia and Afghanistan.

In a report on the case, Chief Prosecutor Eva Finne said police were called to Husby because a man there had threatened a person with a large knife. When they reached the area, the man had locked himself up in his apartment together with his wife.

After several failed attempts to communicate with the man, police entered the apartment, fearing for the woman's safety, and told the man to drop the knife. They used pepper spray, distraction grenades and fired a warning shot into the floor before an officer shot the man in the head as he launched forward in attack mode, Finne said.

The prosecutor said the man's wife was in another part of the apartment when the shooting took place and that the investigation was mainly based on testimony from other police officers involved. However, she added that forensic evidence supports accounts that police fired a warning shot and used distraction grenades.

How the Swedish police handled the situation fell under suspicion after they first released an erroneous report saying the 69-year-old man was taken to a hospital after the shooting. Residents had seen his dead body being transported from the scene hours after the shooting in a hearse, which police later admitted was correct.

Members of the organization Megafonen, which represents citizens in Stockholm's suburbs and led the criticism against police in May, didn't immediately respond to calls seeking a comment Wednesday.