Seven people are dead after a man with a semi-automatic rifle opened fire during a routine traffic stop in Texas and began a terrifying rampage that ended with police gunning him down outside a cinema.

The shooting also left 22 people injured.

Police identified the gunman as Seth Aaron Ator, 36, of Odessa.

Online court records show Ator was arrested in 2001 in Texas, and charged with misdemeanour criminal trespass and evading arrest.

He entered guilty pleas in a deferred prosecution agreement where the charge was waived after he served 24 months of probation, according to records.

That past brush with the law would not have prevented Ator from legally purchasing firearms in Texas, although authorities have not said where he got his weapon.

Ator acted alone and federal investigators believe the gunman had no ties to any domestic or international terrorism group, FBI special agent Christopher Combs said.

Authorities said those killed were between the ages of 15 and 57. The injured included three law enforcement officers.

Odessa police chief Michael Gerke refused to say the name of the gunman during a televised news conference, saying he would not give him notoriety.

Odessa and Midland police and sheriff’s deputies surround the area behind Cinergy cinema in Odessa, Texas
Odessa and Midland police and sheriff’s deputies surround the area behind Cinergy cinema in Odessa, Texas (Tim Fischer/Midland Reporter-Telegram via AP)

He also said there were still no answers pointing to a motive.

The shooting began Saturday afternoon with an interstate traffic stop where gunfire was exchanged with police.

The incident set off a chaotic rampage during which the suspect hijacked a mail lorry and fired at random as he drove in the area of Odessa and Midland, two cities in the heart of Texas oil country more than 300 miles west of Dallas.

US Postal Service officials said Mary Granados, 29, was alone in her lorry and killed in the attack.

A 17-month-old girl who was wounded in the shooting will undergo surgery Monday to remove shrapnel from her right chest but is recovering, Texas governor Greg Abbott said.

Mr Combs said the gunman might have entered the Odessa cinema where the chase ended if police had not taken him down.

Shooting Texas
A man prays outside the Medical Centre Hospital emergency room in Odessa (Mark Rogers/Odessa American via AP)

“In the midst of a man driving down the highway shooting at people, local law enforcement and state troopers pursued him and stopped him from possibly going into a crowded movie theatre and having another event of mass violence,” Mr Combs said.

The shooting came at the end of an already violent month in Texas, where on August 3 a gunman in the border city of El Paso killed 22 people at a Walmart store.

Sitting beside authorities in Odessa, Mr Abbott ticked off a list of mass shootings that have now killed nearly 70 since 2016 in his state alone.

“I have been to too many of these events,” Mr Abbott said.

“Too many Texans are in mourning. Too many Texans have lost their lives. The status quo in Texas is unacceptable, and action is needed.”

Odessa Police Chief Michael Gerke talks to the media
A police officer escorts bystanders away from an area investigated after the shooting (Jacy Lewis/Reporter-Telegram via AP)

But Mr Abbott, a Republican, remains non-committal about imposing any new gun laws in Texas at a time when Democrats and gun-control groups are demanding restrictions.

And even as Mr Abbott spoke, a number of looser gun laws that he signed this year took effect on the first day of September, including one that would arm more teachers in Texas schools.

The terrifying chain of events began when Texas state troopers tried pulling over a car for failing to signal a left turn, Texas Department of Public Safety spokeswoman Katherine Cesinger said.

Before the vehicle came to a complete stop, the driver “pointed a rifle toward the rear window of his car and fired several shots” toward the patrol car stopping him.

The gunshots struck one of two troopers inside the patrol car, Ms Cesinger said, after which the gunman fled and continued shooting.

Two other police officers were shot before the suspect was killed.

Saturday’s shooting brings the number of mass killings in the US. so far this year to 25, matching the number in all of 2018, according to The AP/USATODAY/Northeastern University mass murder database.

The number of people killed this year has already reached 142, surpassing the 140 people who were killed of all last year.

The database tracks homicides where four or more people are killed, not including the offender.

US President Donald Trump has offered contradictory messages in reacting to recent mass shootings.

Days after the El Paso shooting, he said he was eager to implement “very meaningful background checks” on guns and told reporters there was “tremendous support” for action.

He later backed away, saying the current system of background checks was “very, very strong”.

On Sunday, Mr Trump reiterated his more recent calls for greater attention to mental health.