• Those killed by the gunman were a 6-year-old boy, a 13-year-old girl and a man in his 20s. The boy’s mother and his grandmother were also wounded by gunfire.

[Read about the 6-year-old boy who was shot in the back.]

• The gunman, identified by the authorities as Santino William Legan, 19, was carrying a semiautomatic rifle when he was shot and killed by the police. He appeared to have cut through a fence to enter the festival, the Gilroy Police Department said.

• Chief Scot Smithee of the Gilroy Police Department said that the gunman had purchased the weapon legally in Nevada this month.

• There would have been more bloodshed had three officers not responded in under a minute, with one of them fatally shooting the gunman, Chief Smithee said. Thousands of people were still at the festival.