Patrick Crusius, 21, has been charged with capital murder after opening fire inside the El Paso Walmart on Saturday

The man charged with the El Paso Walmart massacre allegedly told police he was targeting Mexicans when he surrendered to authorities in the moments after he gunned down 22 people.

Patrick Crusius, 21, has been charged with capital murder after opening fire inside the Walmart on Saturday with his AK-47.

An arrest warrant affidavit obtained by the Washington Post on Friday indicates that he confessed to police that his targets were 'Mexicans'.

He was taken into custody about a quarter of a mile from the attack after he got off a motorcycle and surrendered with his hands up to an officer.

'I'm the shooter,' he told the officer, according to affidavit.

Just 20 minutes before the massacre, Crusius had posted a white supremacist manifesto online saying the shooting was in response to an 'invasion' of Hispanics coming across the southern border.

Titled 'The Inconvenient Truth,' it railed against the dangers of mass immigration and warned that Hispanics will eventually take over the economy and government.

Authorities believe Crusius wrote the racist, rambling screed that railed against mass immigration.

Scroll down for video

Crusius has been charged with capital murder in state court for the Saturday massacre, in which 22 people were killed and more than two dozen injured

Walmart employees pause while visiting the make shift memorial after the mass shooting that happened at a Walmart in El Paso on Sunday

Police say Crusius, who lived near Dallas, drove more than 10 hours to the largely Latino border city in Texas to carry out the shooting that killed 22 people and wounded about two dozen others.

Mexican officials have said eight of the people killed in the shooting were Mexican nationals. They called the attack an act of terrorism against their citizens on U.S. soil.

Funerals were held in Mexico on Thursday for some of the victims killed in the massacre.

It comes as a lawyer for the suspected gunman's family said they had never heard him express racist views.

Chris Ayres, a Dallas-based attorney for Crusius' family, told The Associated Press in an email they never heard Crusius express the kind of racist and anti-immigrant views that he allegedly posted online.

'These views were never expressed to the family. Ever,' Ayres wrote.

People gather at a make shift memorial for the 22 victims of the Walmart mass shooting

Funerals were held in Mexico on Thursday for some of the victims killed in the massacre. Pictured is the casket of elementary school teacher Elsa Mendoza in Ciudad Juarez, Mexico

The lawyer did not address questions about how the weapon used in the attack was obtained but he said Crusius 'occasionally shot guns, as many do, with his dad.'

A spokesman for the police department in the Dallas suburb where the suspect's family lives confirmed on Thursday that the department had received a telephone call from a woman expressing concern about the legality of Crusius plan to buy an 'AK' style rifle.

Lawyers for the Crusius family say the call came from his mother.

The call came into the Allen Police Department on June 27.

'She was concerned about her son buying a weapon online or at a retail establishment,' Sgt. Jon Felty said.

Specifically, she asked if her son was old enough and what qualifications he would need. She was told that her son was old enough but that a background check would determine whether he was qualified to make the purchase.

Crusius was 20 at the time the call was made. Under Texas law, 18 is the minimum age for buying a firearm from a licensed dealer, but 21 is the minimum age for handgun purchases.

El Paso police have said Crusius purchased his rifle legally.

'At no time did she express a concern for anything but the safety of her son,' Felty said, adding that she was asked if her son might be suicidal or had shown recent behavior changes and said she had seen no changes.