A Texas grand jury on Thursday indicted a man accused of killing 22 people and wounding 26 others in an August shooting at a Walmart in El Paso, Texas, who had told authorities he was targeting Mexicans, a local prosecutor said.

Patrick Crusius, 21, was indicted for capital murder and will face the death penalty if he is convicted, El Paso County District Attorney Jaime Esparza said in a statement.

"The District Attorney's Office will continue to work hard to ensure that justice is done and is committed to assisting the victims through the judicial process," Esparza said.

Crusius is accused of driving 11 hours from his hometown of Allen, Texas, near Dallas to El Paso on Aug. 3 and firing at shoppers with an AK47 rifle inside a Walmart store, after which he surrendered to officers who confronted him outside the store.

Crusius confessed while surrendering and told police he was targeting Mexicans, according to an El Paso police affidavit released days after the shooting.

Most of those killed in the shooting were Hispanic.

The Texas killings were followed just 13 hours later by another mass shooting in Dayton, Ohio, where a gunman in body armor and a mask killed nine people in less than a minute and wounded 27 others in the city's downtown historic district before he was shot dead by police.

The shootings reverberated across the political arena on Sunday as Democratic presidential candidates called for stricter gun laws and accused President Donald Trump of stoking racial tensions.

The indictment against Crusius will not be available to the public until it has been filed by the District Clerk's Office. By law, the clerk's office has 10 days to file the indictment, a spokeswoman for Esparza said.