BOULDER, COLO. -- The suspect in the Colorado supermarket shootings bought a firearm at a local gun store after passing a background check, and he also had a second weapon with him that he didn't use in the attack that killed 10 people this week, authorities and the gun store owner said Friday.

Investigators are working to determine the motive for the shooting, but they don't know yet why the suspect chose the King Soopers grocery store in Boulder or what led him to carry out the rampage, Police Chief Maris Herold said at a news conference.

"Like the rest of the community, we too want to know why -- why that King Soopers, why Boulder, why Monday," Herold said. "It will be something haunting for all of us until we figure that out. Sometimes you just don't figure these things out. But, I am hoping that we will."

The quick response by officers, who traded gunfire with the suspect, kept many people inside the store out of danger, said Boulder County District Attorney Michael Dougherty, who declined to say how many people were in the supermarket. The first officer on scene was killed.

"Their actions saved other civilians from being killed," Dougherty said about the officers. "They charged into the store and immediately faced a very significant amount of gunfire from the shooter, who at first they were unable to locate."

More charges will be filed against 21-year-old Ahmad Al Aliwi Alissa in the coming weeks in connection with firing at officers, Dougherty said.

John Mark Eagleton, owner of Eagles Nest Armory in the Denver suburb of Arvada, said in a statement that his store was co-operating with authorities as they investigate. The suspect passed a background check conducted by the Colorado Bureau of Investigation before purchasing a gun, Eagleton said.

Alissa used a Ruger AR-556 pistol, which resembles an AR-15 rifle with a slightly shorter stock, in the shooting, Herold said. An arrest affidavit says Alissa purchased it on March 16, six days before the shooting.

He also had a 9 mm handgun, which the police chief said was not believed to have been used in the attack. Herold didn't say how Alissa obtained it.

"We are absolutely shocked by what happened and our hearts are broken for the victims and families that are left behind. Ensuring every sale that occurs at our shop is lawful, has always been and will always remain the highest priority for our business," Eagleton said in the statement.

The gun store is in a shopping centre that also has a chiropractic clinic, yoga studio and foot massage parlour. It is less than a half-mile from one of the restaurants Alissa's family owns and about 3 miles (5 kilometres) from his family's house in Arvada. A different King Soopers store is across the street.

Colorado has a universal background check law covering almost all gun sales, but misdemeanour convictions generally do not prevent people from purchasing weapons.

Alissa was convicted in 2018 of misdemeanour assault after he knocked a fellow high school student to the floor, climbed on top of him and punched him in the head several times, according to police documents. He was sentenced to probation and community service.

If Alissa had been convicted of a felony, his gun purchase would have been prohibited under federal law.

Dougherty, the district attorney, said Friday that the FBI and other agencies were looking into the background of Alissa and the victims and didn't yet have information to share. He said federal agencies were looking into "other firearms that might be connected to him" but refused to elaborate.

Dougherty said officials will limit how much they reveal about the investigation, which is expected to take months, to protect Alissa's right to a fair trial and ensure it takes place in Boulder County.

"If we share too much about the facts of the investigation, it's possible we'll see a motion by the defence to move this trial to somewhere else in the state of Colorado," Dougherty said. "And I want to make sure that the people of Boulder have the opportunity for this trial to be held and for justice to be done here."

Alissa made his first court appearance Thursday, where his public defender asked for a mental health evaluation but provided no details about his mental state. He is charged with 10 counts of first-degree murder and one count of attempted murder over shots fired at a police officer who was not hurt.

Alissa was treated at a hospital before going to jail, his hands bound during the transfer by the handcuffs used by Officer Eric Talley, who died in the attack. Alissa has been moved to a jail outside Boulder County due to safety concerns stemming from threats made against him, county sheriff's spokeswoman Carrie Haverfield said in a statement Friday.

Alissa is being held without bail and has not yet entered a plea. His next court hearing will not be scheduled for two to three months to allow his attorneys to evaluate his mental state and evidence collected by investigators.

A Catholic funeral Mass for Talley will be celebrated Monday at a cathedral in downtown Denver. His funeral is scheduled for Tuesday in the Boulder County city of Lafayette. The 51-year-old joined the Police Department in 2010. He had seven children.

------

Anderson reported from Denver. Associated Press writers Brady McCombs and Lindsay Whitehurst in Salt Lake City, Michael Balsamo and Colleen Long in Washington and AP staff members from around the U.S. contributed to this report. Nieberg is a corps member for the Associated Press/Report for America Statehouse News Initiative. Report for America is a non-profit national service program that places journalists in local newsrooms to report on undercovered issues.