The man who allegedly shot 10 people dead and injured three more at a Buffalo, New York, supermarket Saturday likely planned out his racially motivated attack for months, authorities said Sunday.

Police pointed to the roughly 180-page manifesto the alleged shooter, 18-year-old Payton Gendron, posted before going on his rampage. The rambling text included a detailed plan of his assault on the Tops Friendly Market, which he drove to from several counties away, according to police.

"This defendant is accused of traveling to our area and targeting innocent people who were shopping for their groceries on a Saturday afternoon. I continue to pray for all affected by this horrific crime," Erie County District Attorney John Flynn said Saturday. "I am committed to obtaining justice for the victims, their families and this community."

"My office is working closely with the U.S. Attorney’s Office and our partners in law enforcement into potential terrorism and hate crimes. This is an active investigation and additional charges may be filed," he added.

NEW YORK POLICE SAY THAT 13 PEOPLE SHOT, 10 DEAD, DURING 'MASS SHOOTING' AT BUFFALO GROCERY STORE

Gendron identified himself as a white supremacist in his manifesto, detailing at length his fears that white people are being replaced by other races.

Buffalo Mass Shooting

A crowd gathers as police investigate after a shooting at a supermarket on Saturday, May 14, 2022, in Buffalo, N.Y. Multiple people were shot at the Tops Friendly Market. Police have notified the public that the alleged shooter was in custody. (AP Photo/Joshua Bessex)

Among those killed in the shooting was Retired Buffalo Police officer Aaron Salter, who died attempting to protect shoppers from the rampage.

Stalter worked as a security guard at the store and shot Gendron multiple times immediately upon his entering the store, but Genderon's body armor deflected the shots. Gendron then fatally shot Stalter.

CLICK HERE TO GET THE FOX NEWS APP

Buffalo police reached out to Stalter's family to offer condolences on Saturday.

"I had the pleasure of knowing him, great guy, well respected, well-liked. This is just horrific. It’s tragic. I don’t know what other words to describe it," Buffalo Police Benevolent Association President John Evans said, according to WIBV 4.

Gendron pled not guilty to charges of first-degree murder in court on Saturday evening. He is being detained without bail and faces life in prison. He is due back in court on Thursday for a felony hearing.