(The Hill) — The suspect accused of opening fire in a Buffalo, New York, supermarket in May pleaded guilty to charges of murder, murder as a hate crime and hate-motivated domestic terrorism on Monday.

Payton Gendron, a white 19-year-old who was charged with killing 10 Black people, is now guaranteed to spend his life in prison. Three other people were wounded in the attack.

Gendron verbally acknowledged before a judge on Monday that he killed each victim because of their race.

The defendant was 18 years old when he walked into Tops Friendly Market wearing body armor and wielding a legally obtained semi-automatic rifle. The gunman live-streamed his attack online using a helmet camera.

Investigations conducted after the attack, including by New York’s attorney general, found that Gendron chose the location because it was in a predominantly Black neighborhood.

Gendron had written a manifesto explaining he was motivated by the racist “great replacement” theory, which warns of the end of the white race in the U.S. because of increased racial diversity.

Buffalo Mayor Byron Brown, the Buffalo police commissioner and relatives of the shooting victims were present as Gendron pleaded guilty to the state charges on Monday.

The suspect pleaded not guilty earlier this year to separate federal hate crime charges, which could lead to a death sentence if he’s convicted.

The Buffalo shooting was closely followed by a deadly mass shooting at Robb Elementary School in Uvalde, Texas, that killed 19 children and two adults. Similar large-scale shootings have persisted this year, including one that occurred earlier this month at the LGBTQ nightclub Club Q in Colorado Springs, Colo., killing five and injuring 19.