The shooting that killed 20 people at a crowded El Paso department store will be handled as a domestic terrorism case, authorities have said said.
They weighed hate crime charges against the suspected gunman that could carry the death penalty.
A local prosecutor announced that he would file capital murder charges, declaring that the alleged assailant had “lost the right to be among us”.
The attack on Saturday was followed less than a day later by another shooting that claimed nine lives in a nightlife district of Dayton, Ohio.
That gunman was killed by police.
Together the two assaults wounded more than 50 people, some of them critically, and shocked even a nation that has grown accustomed to regular spasms of gun violence.
Investigators focused on whether the El Paso attack was a hate crime after the emergence of a racist, anti-immigrant screed that was posted online shortly beforehand.
Detectives sought to determine if it was written by the man who was arrested.
The border city has figured prominently in the immigration debate and is home to 680,000 people, most of them Latino.
Using a rifle, the El Paso gunman opened fire on shoppers during the busy back-to-school season.
The attack targeted a Walmart and did not spread to other nearby shopping areas, El Paso police sergeant Robert Gomez said.
Most victims were inside the store. By Sunday evening, all bodies had been removed from the store and the car park, police said, but no names or ages were released.
Despite initial reports of possible multiple gunmen, the man in custody was believed to be the only gunman, police said.
Law enforcement officials identified him as 21-year-old Patrick Crusius from Allen, a Dallas suburb which is a nearly 10-hour drive from El Paso.
He was arrested without police firing any shots and was jailed without bond, authorities said.
Crusius surrendered after being confronted by officers on a pavement close to the scene. Police did not know how many bullets were fired or why the attack stopped, Mr Gomez said.
“We don’t have information on what prompted him to stop firing,” he added.
El Paso Police Chief Greg Allen said the suspect was cooperative and “forthcoming with information”.
Relatives said a 25-year-old woman who was shot while apparently trying to shield her two-month-old son was among those killed. Mexican officials said six Mexican nationals were also among the dead.
Mexico planned to take legal action against whoever sold the gun to the suspect, the country’s foreign minister said. Gun ownership is highly restricted in Mexico, requiring special permits, and gun shops are rare.
President Donald Trump denounced both shootings, saying “hate has no place in our country”.
Addressing reporters in Morristown, New Jersey, the president said on Sunday that “we’re going to take care” of the problem.
Authorities searched for any links between the suspect and the material in the document that was posted online, including the writer’s expression of concern that an influx of Hispanics into the United States will replace ageing white voters, potentially turning Texas blue in elections and swinging the White House to Democrats.
The writer was also critical of Republicans for what he described as close ties to corporations and degradation of the environment.
Though a Twitter account that appears to belong to Crusius included pro-Trump posts praising the plan to build more border wall, the writer of the online document says his views on race pre-dated Trump’s campaign and that any attempt to blame the president for his actions was “fake news”.
The writer denied he was a white supremacist, but the document says “race mixing” is destroying the nation and recommends dividing the United States into territorial enclaves determined by race.
The first sentence of the four-page document expresses support for the man accused of killing 51 people at two New Zealand mosques in March after posting his own screed with a conspiracy theory about non-white migrants replacing whites.
El Paso County is more than 80% Latino, according to the latest census data. Tens of thousands of Mexicans legally cross the border each day to work and shop in the city.
Mr Trump visited in February to argue that walling off the southern border would make the US safer. City residents and Democratic presidential candidate Beto O’Rourke, who is from El Paso, led thousands on a protest march past the barrier of barbed wire-topped fencing and towering metal slats.
Mr O’Rourke, a former Texas congressman, stressed that border walls have not made his hometown safer. The city’s murder rate was less than half the national average in 2005, the year before the start of its border fence. Before the wall project started, El Paso had been rated one of the three safest major US cities going back to 1997.