Seven other people were injured, three of them critically, in the attack at Allen Premium Outlets, the latest incident of gun violence in the US.
Police identified the gunman as Mauricio Garcia who had been staying at a nearby hotel. An official said investigators have been searching the hotel and a home in the Dallas area connected to the suspect.
The official said the police also found multiple weapons in the scene after Garcia was shot dead by a police officer. The weapons included an AR-15-style rifle and a handgun.
Authorities did not immediately provide details about the victims, but witnesses reported seeing children among them.
Some said they also saw what appeared to be a police officer and a mall security guard unconscious on the ground.
The dashcam video that was circulated online showed a gunman stepping out of a vehicle outside the shopping center and immediately starting shooting at people on the pavement. More than three dozen shots could be heard as the vehicle recording the video drove off.
Maxwell Gum, a 16-year-old shift leader at Wetzel’s Pretzels, was on his lunch break when a family with limited English ran into the back of his store, urgently telling him “Gun! Shoot!” as the sound of gunfire could be heard in the background.
He took the family into the long delivery corridor that runs behind the shops, hoping it would be a safe place to hide. They found chaos.
“There were probably like 300 people pouring in from all the different doors,” the teenager said. “People are freaking out, we’re hearing screaming.”
Allen Fire Chief Jonathan Boyd said seven people including the gunman died in the scene. Nine victims were taken to the hospital area, but two of them died.
Three of the victims were in a critical condition on Saturday evening, Mr Boyd said, and four were in a stable condition.
Officials received reports of gunshots from the Allen Premium Outlets at around 3.40pm.
Medical City Healthcare, a Dallas-area hospital system, said in a written statement it was treating eight people between the ages of five and 61.
An Allen Police officer was in the area on an unrelated call when he heard gunshots at Allen Premium Outlets at 3.36pm, the police department wrote on Facebook.
“The officer engaged the suspect and neutralized the threat. He then called for emergency personnel. Nine victims were transported to local hospitals by Allen Fire Department,” the agency wrote in the Facebook post. “There is no longer an active threat.”
A crowd of hundreds of people who had been shopping stood outside, across the street from the mall, on Saturday evening.
Officers circulated among them asking if anyone had seen what happened.
Fontayne Payton, 35, was at H&M when he heard the sound of gunshots through the headphones he was wearing.
“It was so loud, it sounded like it was right outside,” Mr. Payton said.
People in the store scattered before employees ushered the group into the fitting room and then a lockable back room, he said.
When they were given the all-clear to leave, Mr Payton saw the store had broken windows and a trail of blood to the door. Discarded sandals and bloodied clothes lay nearby.
Once outside, Mr. Payton said he saw bodies.
“I pray it wasn’t kids, but it looked like kids,” he said. The bodies were covered in white towels, slumped over bags on the ground, he said.
“It broke me when I walked out to see that,” he said.
Further away, he saw the body of a heavyset man wearing all black. He assumed he was the gunman, Mr Payton said, because unlike the other bodies he had not been covered up.
Tarakram Nunna, 25, and Ramakrishna Mullapudi, 26, said they saw what appeared to be three people lying motionless on the ground, including one who appeared to be a police officer and another who appeared to be a mall security guard.
Another shopper, Sharkie Mouli, 24, said he hid in a Banana Republic store during the shooting. As he left, he saw what appeared to be an unconscious police officer lying next to another unconscious person outside the outlet store.
“I have seen his gun lying right next to him and a guy who is like passing out right next to him,” Mr Mouli said.
Stan and Mary Ann Greene were browsing in the Columbia sportswear store when the shooting started.
“We had just gotten in, just a few minutes earlier, and we just heard a lot of loud popping,” Mary Ann Greene told AP.
Employees immediately rolled down the security gate and took everyone to the back of the store until the police arrived and escorted them out, the Greenes said.
Eber Romero was at the Under Armor store when a cashier mentioned there had been a shooting.
As he left the store, Mr. Romero said, the mall appeared empty, and all the shops had their security gates down. That is when he started seeing broken glass and people who had been shot on the ground.
Videos shared on social media showed people running through a car park while gunfire could be heard.
More than 30 police cruisers with flashing lights were blocking an entrance to the shopping center, with multiple ambulances on the scene.
A live aerial broadcast from the news station showed armored trucks and other law enforcement vehicles stationed outside the sprawling outdoor mall.
On Sunday, the community began mourning those killed in the mass shooting.
John Mark Caton, senior pastor at Cottonwood Creek Church, about two miles from the shopping center, offered prayers during his weekly service for victims, first responders and the shoppers and employees who “walked out past things they should never have seen”.
“Some of our people were there. Some perhaps in this room. Some of our students were working in those stores and will be changed forever by this,” he said.
Recalling phone conversations with police officers, he added: “There wasn’t an officer that I talked to yesterday that at some point in the call didn’t cry.”