Before carrying out the attack, the gunman published a white supremacist manifesto online

The 21-year-old Texan who killed 22 people in an El Paso Walmart told police following his arrest that he was targeting "Mexicans," according to an arrest warrant published Friday by US media.

The document charging Patrick Crusius, of Allen, Texas, with murder also described the circumstances of his arrest, saying he stepped out of his vehicle when surrounded by police, put his hands up and said "I'm the shooter."

At police headquarters, Crusius waived his right to remain silent or have a lawyer present and told detectives that "his target (was) 'Mexicans,'" according to the document, obtained by The Washington Post and others.

Prior to carrying out the attack Saturday, Crusius published a white supremacist manifesto online which expressed fears of a "Hispanic invasion" of Texas.

Eight of the people killed in the rampage were Mexican nationals and many of the other victims were Americans of Hispanic origin.

In the manifesto, Crusius claimed he was "defending" the United States "from cultural and ethnic replacement brought on by an invasion" and made references to the Christchurch shootings in New Zealand, where a white gunman killed 51 worshippers at two mosques in March.

El Paso is about a nine-hour drive from Allen, where Crusius lived, and he apparently deliberately selected the city because of its heavily Hispanic population.

El Paso lies on the Rio Grande River which marks the US border with Mexico. It has a population of 680,000, of which 83 percent are of Hispanic descent.