At least 27 people were injured and 8 died in the shooting in Ohio the second of such attack in the US within 24 hours.
Police says the gunman behind the mass shooting in Dayton, Ohio, killed his sister and eight other people in an attack that lasted less than 30 seconds.
Dayton police chief Richard Biehl said that had it been he made it through the door, the loss of life would have been “catastrophic”.
Nearby police officers engaged Connor Betts, 24, shortly after hearing gunfire, as he tried to make his way into a crowded bar.
The gunman’s motives are unclear.
Security camera footage shows dozens of people racing through the doorway of the local Ned Peppers nightclub.
Seconds later, Betts is seen running towards the venue and being hit by police gunfire as he reaches the door.
Betts wore body armour and came carrying extra ammunition for his .223-calibre assault rifle with high-capacity magazines.
“Had this individual made it through the doorway of Ned Peppers with that level of weaponry, there would have been catastrophic injury and loss of life,” Mr Biehl said.
The rifle was ordered online from Texas, police said, and there was nothing in his history that would have stopped him from buying the gun legally.
The gunman’s sister, Megan Betts, aged 22, was among the dead.
“She was not the first victim, but she was one of the initial victims,” Mr Biehl said.
But responding to questions about a possible racial element to the killings, Mr Biehl said there was nothing to suggest a “bias motive”.
Nearby hospitals had received 27 people for treatment, and discharged 15 of them, by 10:00 local time.
The Gun Violence Archive, which categorizes mass shootings in the US as four or more people shot or killed, says there have been 251 so far this year.
Who are the victims?
Police listed all nine of those who died. They are:
Lois Oglesby, black female, 27
Megan Betts, white female, 22
Saeed Saleh, black male, 38
Derrick Fudge, black male, 57
Logan Turner, white male, 30
Nicholas Cummer, white male, 25
Thomas McNichols, black male, 25
Beatrice Warren Curtice, black female, 36
Monica Brickhouse, black female, 39
Who was the attacker?
Hours after he had been named by the media, police officials confirmed the gunman’s identity as 24-year-old Connor Betts from Bellbrook, Ohio.
Police searched his home on Sunday.
Earlier, US media reported that his sister had been found dead in a car with her boyfriend. But police said the male she was shot alongside was a “companion of the suspect” and did not elaborate on the relationships.
“We don’t know the thoughts of the shooter,” Mayor Nan Whaley said.
FBI agents are assisting police with the investigation.
At a series of news conferences, Mayor Whaley asked people to think of those people “who went downtown on a Saturday night and thought they’d be safe”.
She said that the Oregon district was “one of the safest places in the whole region”.
“Frankly, we’re at a situation now in our country that these are so random,” she said.
She also said the city had gone through a “really tough year”, drawing a comparison to a series of 14 tornadoes that hit Dayton in March.
“What really goes through my mind is one seems completely preventable,” she said. “I just question when is enough, enough.”
President Donald Trump told reporters that “hate has no place in our country” shortly before boarding Air Force One in Morristown, New Jersey.
Mr Trump said mass shootings in the US had been “going on for years” and had to be stopped.
When asked about possible gun regulations, the president said “perhaps more has to be done” to prevent shootings, but stopped short of making any commitments.