MEXICO CITY — Mexican officials on Sunday angrily denounced the mass shooting in El Paso and announced unusual actions to protect Mexicans in the United States — including possibly charging the perpetrator in Mexican courts.

Officials said eight Mexicans were among the 22 fatalities from the attack Saturday in the border city, and seven more were wounded.

Foreign Minister Marcelo Ebrard said Mexico would take actions, including possibly bringing a criminal case against the shooter and supporting a lawsuit against the seller of the weapon used in the massacre.

“Mexico declares its profound rejection and complete condemnation of this barbaric act, in which innocent Mexican men and women lost their lives,” Ebrard said in a recorded message on his Twitter feed.

The remarks represented a toughening of Mexico’s official reaction to the shootings. On Saturday, President Andrés Manuel López Obrador appeared to play down the U.S. government’s responsibility for the violence, saying the attack was “a product of [societal] decomposition, of problems certain people have. It’s not a generalized issue.”

But there were increasing indications that the shooting was aimed at Mexicans. Investigators are studying a manifesto they believe the suspect posted online before the attack; it includes screeds against immigrants.

Mexican officials didn’t single out President Trump, who has often lashed out at Mexicans and other immigrants. They made clear, though, that they were alarmed by the rise of anti-immigrant hate speech in their northern neighbor.

“The intentionality of the attack against the Mexicans and the Latino community in El Paso is frightening,” Mexico’s ambassador to Washington, Martha Bárcena, wrote on Twitter. “NO to hate speech. NO to xenophobic discourse.”

López Obrador said Mexico did not want to get mixed up in the U.S. presidential campaign. But, he said, “we reaffirm our conviction that no one should confront social problems with the use of force or by inciting others to violence.”

The Mexican president, who built his political career as a leftist, has surprised his followers and critics alike by agreeing to Trump’s demands in recent months for a crackdown on Central American migrants crossing Mexico en route to the U.S. border. He has highlighted his good relations with Trump. 

Analysts believe López Obrador has been anxious to avoid antagonizing Mexico’s largest trading partner, the recipient of 80 percent of its exports.

But there was no missing the officials’ angry tones Sunday. 

“Mexico is indignant,” Ebrard told journalists. “But we are not proposing to meet hate with hate. We will act with reason and within the law, but with firmness.” 

He said Mexico would ask U.S. officials to share information on how the gun used in the shooting was obtained. Mexican authorities “will promote legal actions against whoever turns out to be responsible for the sale of the assault weapon” used in the crime, he said. 

 The Mexican government would also ask Mexico’s attorney general to consider charging the suspect, identified as a 21-year-old Texan, with committing terrorist acts against Mexicans in the United States.

“As far as I know, this would be the first case of this type in history,” Ebrard said. The Mexican government could even seek to extradite the suspect, he said. 

“For Mexico, this individual is a terrorist,” he said.

The alleged shooter will almost certainly be tried first in a U.S. court. 

If he is convicted, it’s unlikely he would be sent to Mexico to stand trial. But the Mexican legal action could help the country gain more information on the investigation. 

Ebrard said Mexico would send a diplomatic note to Washington “asking respectfully but firmly that they take a clear, strong position against hate crimes.”

 Mexico is planning to convene a conference with other Spanish-speaking countries that have immigrant communities in the United States to promote their defense, Ebrard said.

He identified the eight Mexican El Paso victims as Sara Esther Regalado of Ciudad Juarez; Adolfo Cerros Hernández of Aguascalientes; Jorge Calvillo García of Torreon; Elsa Mendoza of Yepomera; Gloria Irma Márquez of Ciudad Juarez; María Eugenia Legarretta Rothe of Chihuahua City; Iván Filiberto Manzano of Ciudad Juarez; and Juan de Dios Velázquez Chairez of Zacatecas.

Mexican media identified Mendoza as the principal of the Rafael Veloz primary school in Ciudad Juarez, just across the border from El Paso. The newspaper Reforma said she was killed while in the supermarket section of Walmart in the Texas city.

López Obrador is a longtime defender of Mexican immigrants in the United States. In 2017, a year before his election, he published a book, titled “Listen Up, Trump,” of his speeches and proposals to support Mexican migrants.

Shock at the shooting rampage reverberated through Ciudad Juarez. Many residents routinely cross the border to shop or visit family and friends in Texas.

On Sunday, as on most days, there were long lines of cars waiting to head into the United States. But some drivers told Mexican reporters that they were nervous about their safety on the U.S. side — an ironic sentiment, given that, unlike El Paso, Juarez is violent, with more than 800 homicides recorded from January to mid-July.