WASHINGTON — President Trump gave medals and commendations to police and bystanders who responded to deadly mass shootings last month in Ohio and Texas, but did not include any of the officers who ended the fatal attack at the Gilroy Garlic Festival days earlier.

The administration did not reply to a question as to why only first responders from Dayton, Ohio, and El Paso, Texas, were honored at Monday’s White House event. Trump gave the Medal of Valor to six police officers from Dayton and Certificates of Commendation to five civilians from El Paso.

The shooting at the Gilroy event July 28 killed three people and injured 17. A 19-year-old gunman armed with an AK-47-style assault rifle he bought in Nevada cut through a fence to enter the festival and opened fire on the crowd.

Within one minute of the first call to 911, three officers confronted the gunman and shot him multiple times. The assailant then shot himself to death, according to the Santa Clara County coroner.

Six days later, a gunman at an El Paso Walmart killed 22 people and wounded 27, and the next day nine people were killed and 34 injured in the Dayton shooting.

The attacks provided a fresh rallying cry for Congress to pass legislation to prevent gun violence.

Rep. Zoe Lofgren, whose district includes Gilroy, was surprised to find out the White House had left the garlic festival first responders out of the event Monday.

“Nothing for Gilroy?” the San Jose Democrat said. “That’s really tawdry. That’s terrible.”

She said she was not aware of any outreach from the White House to honor victims or officials from her district. Shortly after the shootings, Trump visited both Dayton and El Paso, but did not travel to California.

“I don’t know if they want the president to visit or not, but certainly those first responders were incredibly brave and deserve recognition,” Lofgren said. “The first responders in Gilroy were awesome. I mean, they were there in under a minute.”

Without the quick response, she said, “there would have been hundreds of people injured.”

Gilroy Mayor Roland Velasco, a Republican, told The Chronicle that his understanding was the White House was recognizing officers who were wounded. “We are fortunate that no Gilroy officers were injured,” he said in an email.

However, only one of Monday’s honorees, and none of the officers, were wounded in the shootings.

The White House event also did not include officers who responded to an Aug. 31 incident in Midland and Odessa, Texas, when a gunman killed seven people, wounded 22 and engaged in two shootouts with police that resulted in three officers being injured.

Trump has had a tense relationship with California. He visited the state last year to survey devastating wildfire damage and is close with Rep. Kevin McCarthy, the House GOP leader from Bakersfield, but has also threatened to cut off disaster relief to the state and is embroiled in multiple lawsuits with California over policy.

The White House ceremony came as Congress returned from a six-week break for work in their districts, with gun violence prevention legislation a top priority for Democrats. The White House is working on a package of ideas, lawmakers say, but optimism remains limited that Republicans and Democrats will agree on anything.

Democrats want the Senate to pass a House bill expanding background checks to all gun sales, which was authored by North Bay Democratic Rep. Mike Thompson. Senate Majority Leader Mitch McConnell, R-Ky., has refused to bring it up.

Thompson said Monday that although first responders deserve to be recognized, the best way to honor mass-shooting victims is to pass gun legislation.

“First responders are fantastic — they’ve done a great job in every one of these situations. But if we want to stop gun violence, we don’t give medals to people who do a great job,” Thompson said. “We pass a bill that will put a law in place that will help prevent gun violence.”

An earlier version of this story said the Gilroy gunman was fatally shot by three police officers. The Santa Clara County coroner said the officers shot the man multiple times, and that he then killed himself with his own gun.

San Francisco Chronicle staff writer Matthias Gafni contributed to this report.

Tal Kopan is The San Francisco Chronicle’s Washington correspondent. Email: tal.kopan@sfchronicle.com Twitter: @talkopan