WASHINGTON -- President Donald Trump expressed a commitment Sunday, hours after the latest deadly mass shooting, to work with a divided Congress to "stop the menace of mass attacks." He said any measures must satisfy the competing goals of protecting public safety and the constitutional right to gun ownership and seemed to cast fresh doubt on the merits of instituting more thorough background checks for gun purchases.

Trump spoke shortly after the death toll in Saturday's rampage in West Texas rose to seven as authorities worked to understand why a man pulled over for a traffic infraction opened fire on state troopers and fled. He shot more than 20 people before he was killed by police. A motive has not been released.

The president said it would be "wonderful to say" he'd work to "eliminate" mass shootings, but acknowledged that that was unlikely.

"We want to substantially reduce the violent crime," Trump said at the top of a briefing about Hurricane Dorian at Federal Emergency Management Agency headquarters in Washington.

Trump's commitment to gun control has been in doubt ever since 17 students and adults were killed in a shooting at a Parkland, Florida, high school on Valentine's Day in 2018. Trump came out in favor of stronger background checks after the shooting, but then quickly retreated under pressure from the National Rifle Association, the politically powerfully gun owners' lobby that strongly backed his bid to become president.

More recently, he has waffled on the merits of stronger background checks for gun purchases in the aftermath of back-to-back shootings in El Paso, Texas, and Dayton, Ohio, that killed more than 30 people about a month ago. Instead, Trump sought to elevate mental health issues over access to guns.

"For the most part, sadly, if you look at the last four or five (shootings) going back even five or six or seven years, for the most part, as strong as you make your background checks, they would not have stopped any of it," he said. "So it's a big problem. It's a mental problem. It's a big problem."

Trump mentioned the need for "strong measures to keep weapons out of the hands of dangerous and deranged individuals" along with changes to a mental health system he described as "broken." He also called for ensuring that criminals with guns "are put behind bars and kept off the streets."

"Public safety is our No. 1 priority, always wanting to protect our Second Amendment. So important," he said, referring to the constitutional amendment that established the right to keep and bear arms.

Trump told reporters earlier Sunday that he's been speaking to lawmakers from both political parties and "people want to do something." He said the administration is "looking at a lot of different things" and hopes to have a package ready by the time Congress returns to session next week.

The Republican-controlled Senate has refused to take up several gun-control bills that passed the Democratic-controlled House this year, and the GOP historically has opposed many efforts to strengthen the nation's gun laws.

House Speaker Nancy Pelosi called on the Republican-controlled Senate to "end its obstruction" and send the gun violence measures to Trump.

Republican Sen. Pat Toomey of Pennsylvania said he has discussed the issue with Trump and described the president as "very interested in doing something meaningful." Toomey has long pushed a bipartisan bill with Democratic Sen. Joe Manchin of West Virginia to expand background checks and said he remains interested in measures to keep guns away from people who shouldn't have them.

"We're going to take a very serious run at it," he said.

Others, like Republican Sen. Rick Scott of Florida, argued that Congress should use his state as a model.

Scott, who was governor at the time of the Parkland school shooting, said officials sat down within days of the massacre with law enforcement, mental health counselors and educators. Legislation was quickly passed and signed into law, including a "red-flag" statute that would allow authorities to confiscate weapons from individuals deemed by the courts to be a threat to themselves or others.

Scott said he doesn't want to take guns away from law-abiding citizens, but added that "we've got to figure out how we get guns away from mentally ill people who want to harm others or themselves."

In the days immediately after the August shootings in Texas and Ohio, Trump said he was eager to implement "very meaningful background checks," saying there was "tremendous support" for it. He also said he disagreed with the NRA's stance that such legislation would open the door to infringing on Second Amendment rights.

But the president has also acknowledged that his core supporters support gun rights, which highlights the challenge he has to balance the politics of gun control before he stands for reelection in November 2020.

Toomey was interviewed on ABC's "This Week," and Scott spoke on NBC's "Meet the Press."