Image copyright Montgomery County District Attorney

Four people were shot and several more injured when a gunman opened fire by the checkout of a Walmart during an argument with another customer.

Police say Keenan Jones, 30, fired at least 10 shots, some indiscriminately, as shoppers ran for cover during the fracas in the Philadelphia suburbs.

Officials say Mr Jones and his sister fled the supermarket before crashing into a police car.

Both were detained as Mr Jones fought with police, officers say.

He is charged with one count of attempted murder, 13 counts of aggravated assault and 19 counts of reckless endangerment, as well as gun charges.

His sister has not been named or charged.

Image copyright CBS Image caption News helicopters filmed the suspect struggling with police

"The surveillance depicts Jones standing in the checkout line and then starting to walk towards the back of the line when he pulls out a black semi-automatic handgun and fires a single round at a male who is standing only feet away, striking him," the criminal complaint filed on Wednesday read, reports NBC Philadelphia.

"Jones then begins to run through the front end of the store and is seen firing additional rounds indiscriminately."

The victims' injuries were reportedly non-life threatening.

Mr Jones has previous convictions that bar him from possessing a gun, reports WPVI-TV. He is being held on $1m cash bail.

Cheltenham Township Police Chief John Frye told a news conference on Tuesday night: "It seems there was some sort of altercation at the cash register.

"Words were exchanged."

He did not specify the nature of the argument at the checkout, which happened just after 18:00 local time (22:00 GMT) as the Walmart was crowded with shoppers.

Chief John Frye said the suspect "pulled the gun from the female's waistband and started shooting".

Image copyright CBS

Two women and a man were all shot in the leg. Another person suffered a graze wound, and a pregnant woman was taken to hospital after falling.

Mr Jones and his sister fled the scene in a Pontiac Grand Prix, say police.

Witnesses saw the handgun being tossed out of the car's window.

Police say the siblings crashed into an empty Philadelphia police car, and Mr Jones fought with officers.

Once placed inside the police car, Jones allegedly tried to kick out the window and attacked officers even though he was cuffed, according to local media.

Image copyright CBS Image caption The suspect was arrested after crashing into a parked police car

They used a stun gun to subdue him. Two officers suffered minor injuries in the struggle and were taken to hospital.

Chief Frye said that hospital reports suggest the shooter was "definitely on some type of drugs".

WPVI-TV captured footage of the suspect being brought to the police station in hand and leg cuffs.

"I'm sorry, man," he said to the camera. "I thought somebody was going to kill me."

More than 22 police departments responded to the crime scene, and Swat teams were called to clear the building and surrounding businesses in the plaza.

In a statement, Walmart confirmed that three of those injured were their employees.

"We are relieved that an arrest has been made and thankful that injuries sustained by three of our associates and a customer are non-life threatening," said Walmart representative Randy Hargrove.