A 16-year-old has been detained on suspicion of shooting and killing three people in Sweden, prosecutors have said.