The man accused of gunning down 22 people at an El Paso Walmart last week confessed to the grisly crime and admitted he was targeting people of Mexican descent, according to unsealed court documents Friday.

Texas Rangers, responding to the scene in an unmarked car, came up to a vehicle in the left-hand turn lane at an intersection when the suspect surrendered, according to the arrest warrant written by El Paso police Det. Adrian Garcia.

"Agents and police officers at the intersection then observed a male person (defendant) to exit out of the vehicle with his hands raised in the air and stated out loud to the agents 'I'm the shooter,'" Garcia wrote.

Patrick Crusius, 21, later waived his Miranda rights against self-incrimination and spoke with detectives.

"The defendant stated he drove to the listed location from Allen, TX and entered the store with an assault rifle (AK-47) shooting multiple innocent victims," Garcia wrote. "The defendant stated his target were 'Mexicans.'"

An overwhelming majority of those killed had Spanish surnames. El Paso's population is more than 80 percent Hispanic, according to the most recent census data.

The suspect has been charged with capital murder and is being held without bail. El Paso prosecutors have already said they will seek the death penalty.

Just before Saturday's attack, a hate-filled racist screed, linked to the suspect, was posted on 8chan, an online forum popular with extremists. The rant decried the "invasion" of Mexican immigrants to the United States and hailed the Christchurch, New Zealand, mosque shooter, an anti-immigrant white supremacist who left 51 dead in March.

The writer said he was angry about Mexican immigration long before the election of President Donald Trump, who based much of his 2016 campaign on building a wall between the U.S. and Mexico.

El Paso police originally said 20 people were killed Saturday but two more died from their wounds in the following days. About two dozen others were injured in the attack.

The El Paso shooting preceded another mass shooting the following day in Dayton, Ohio, where nine people were killed in a popular downtown entertainment district.