A man who was pulled over by Texas troopers shot at them with a rifle and sped away, setting off a terrifying rampage that ended with seven victims and the shooter dead, police said.

After he opened fire during a traffic stop Saturday in Midland, the gunman drove on the streets and the highway, spraying bullets randomly at residents and motorists.

He then hijacked a postal truck and ditched his gold Honda, shooting at people as he made his way into Odessa about 20 miles away. There, police confronted him in a movie theater parking lot and killed him in a shootout.

About 20 people were also injured. Those included a 17-month-old girl and three law enforcement officers, hospital and police officials said.

It's unclear why police pulled over the unidentified gunman or what his motive was. Odessa Police Chief Michael Gerke described him as a white male in his 30s but declined to provide additional information.

The attack during the busy Labor Day weekend put people on edge in a state where a gunman killed 22 less than a month ago at a Walmart in El Paso , about 285 miles west of Odessa.

He grabbed his rifle and pointed it at officers

The chaotic afternoon started at 3:13 p.m. local time.

Two troopers from the Texas Department of Public Safety stopped a lone driver during a traffic stop on westbound Interstate 20 in Midland, authorities said.

Before the vehicle came to a complete stop, the man grabbed a rifle, pointed it out his rear window and fired toward the troopers' patrol unit, wounding one of the troopers, said Lt. Elizabeth Carter of the Department of Public Safety.

The shooter then drove west into Odessa and continued firing through the city and around shopping centers, the police chief said.

He abandoned his vehicle, stole a mail truck and shot at more people as he headed toward the Cinergy movie theater, where he exchanged fire with officers in the parking lot.

At first, authorities had suggested there were two shooters because they thought the man in the mail truck was different from the one in the Honda, police said.

The victims included a 17-month-old girl

Of the three injured law enforcement officers, one was a trooper from the Department of Public Safety and the other two from Midland and Odessa police departments. The trooper is in serious condition and the officers are in stable condition.

Police have not released details on those killed or injured and the US Postal Service declined to comment on the condition of the mail carrier whose truck was stolen. The Ector County school district in Odessa said one of its students was among those killed.

The 17-month-old was airlifted to University Medical Center in Lubbock, where she was in satisfactory condition, hospital officials said.

A witness describes shootout with officers

Alex Woods drove up to the movie theater about five minutes before the shootout and saw several police vehicles with flashing lights.

"There was just police everywhere and there was a bunch of people behind the theater in the field walking and next thing you know this gunfire is going off," he said. "I hear a pop, so, I flip the camera to where the theater's at and I just see a bunch of gunfire going off."

Woods said he saw the officer walk up to the mail van and fire into it, describing the incident as surreal.

"I believe that is when the shooter was killed," he added. "It just all happened so quickly."

Mike Barrett said his friend was shot and hospitalized with injuries.

"He was on the way home, him and his wife ... he got shot," Barrett said. "It went through the door of the car and shot him right in his side ... his wife was just covered in blood."

Texas gun laws to go into effect today

The shooting happened hours before a series of firearm laws go into effect in Texas, where four of the 10 deadliest mass shootings in modern US history have occurred.

The new measures will loosen gun restrictions and allow weapons on school grounds, apartments and places of worship.

After the shooting Saturday, Democratic presidential candidates issued statements calling for gun reform.

"Our hearts are with Midland, Odessa, and everyone in West Texas who has to endure this again ... We need to end this epidemic," Texas native Beto O'Rourke tweeted.

Julián Castro, another Democratic presidential candidate, said the shootings will continue if no action is taken. "We have to be more honest with ourselves. This is going to happen again. And again," he tweeted.

Vice President Mike Pence said he and President Donald Trump are determined to work with Congress "to address and confront this scourge of mass atrocity in our country."

