BUFFALO, N.Y. (AP) — The white gunman accused of killing 10 Black people in a racist attack at a Buffalo supermarket has been charged with federal hate crimes and could face the death penalty, according to a criminal complaint filed Wednesday.

Payton Gendron was already facing a mandatory life sentence without parole if convicted on previously filed state charges in the May 14 rampage.

Attorney General Merrick Garland was expected to address the federal charges during a visit Wednesday to Buffalo. There, he was scheduled to meet with families of the 10 Black people killed.

The attack, at Tops Friendly Market, also left three survivors — one Black, two white.

Gendron’s radical, racist worldview and extensive preparation for the attack were laid out in documents he apparently authored and posted online shortly before authorities say he started shooting.

FBI agents executing a search warrant at Gendron’s home the day after the shooting found a note in which he apologized to his family for the shooting and stated that he “had to commit this attack” because he cares “for the future of the White race,” according to an affidavit filed with the criminal complaint.

Gendron signed the note and addressed it to his family, the affidavit said.

Agents at the Conklin, New York home also found a receipt for a candy bar purchased from the supermarket on March 8, the day Gendron said in an online diary he went to scout out the store, as well as hand drawn sketches of the store’s layout, the affidavit said.

The affidavit also includes detailed accounts of Gendron’s plot to attack the store, which he documented in detail in an online diary, and the attack itself, which he live streamed on social media.

In his writings, Gendron embraced a baseless conspiracy theory about a plot to diminish white Americans’ power and “replace” them with people of color, through immigration and other means.

The posts detail months of reconnaissance, demographic research and shooting practice for a bloodbath aimed at scaring everyone who isn’t white and Christian into leaving the country.

Gendron drove more than 200 miles (320 kilometers) from his home in a nearly all-white town near the New York-Pennsylvania border to a predominantly Black part of Buffalo. There, authorities say, he mowed down shoppers and workers using an AR-15-style rifle, wearing body armor to protect himself and livestreaming the carnage from a helmet-mounted camera.

The 18-year-old surrendered to police as he exited the supermarket.

He has pleaded not guilty to a state domestic terrorism charge, including hate-motivated domestic terrorism and murder.

According to the online documents attributed to Gendron, he had scouted out the supermarket in March, drawing maps and even counting up the number of Black people he saw there.

Federal authorities had said they were considering hate crime charges in the killings, which compounded the unabating toll of gun violence in the United States.

Ten days after the attack in Buffalo, another 18-year-old with a semi-automatic rifle opened fire at a Uvalde, Texas elementary school, killing 19 children and two teachers.

Soon after, New York Gov. Kathy Hochul signed 10 public safety-related bills, including one prohibiting New Yorkers under age 21 from buying semi-automatic rifles and another that revised the state’s “red flag” law, which allows courts to temporarily take away guns from people who might be a threat to themselves or others.

The U.S. Senate followed on June 12 with a bipartisan agreement on more modest federal gun curbs and stepped-up efforts to improve school safety and mental health programs.