Even with the car windows up, you can smell Gilroy, Calif.

The odor, pungent and toasty, wafts from plants processing garlic, the miraculously flavorful allium that forms the base of Mexican salsa roja, Italian marinara, Creole gumbo and Korean kimchi.

Forty years ago, Gilroy transformed its infamous stench from a punch line into a point of pride by starting the Gilroy Garlic Festival. Equal parts tourist attraction and local reunion, it became on Sunday the site of a mass shooting that left three people dead and another dozen wounded.

A 6-year-old boy, a 13-year-old girl and a man in his 20s were killed, the authorities said. They said the 19-year-old gunman, who was killed at the scene and whose motive was not immediately clear, carried out the shooting with a semiautomatic rifle that he had purchased legally this month in Nevada.