The motive was unclear but the police said they were investigating if the shooting had been gang-related.