Pennsylvania State Police investigate the murder of three people and suicide of the shooter 24-year-old Randy Robert Stair, of Dallas, Pa., at the Weis supermarket in Eaton Township, Pa., on Thursday. (Jake Danna Stevens/Scranton Times Tribune via AP)

Before heading to his overnight shift at a Pennsylvania supermarket Wednesday, Randy Stair posted a trove of disturbing videos and files online documenting his plans to kill his co-workers.

Then, in a last message posted on Twitter, the 24-year-old wrote: “Goodbye humans. … I’ll miss you …”

Stair’s shift at Weis grocery in Tunkhannock, Pa., began at 11 p.m., just as the store was closing. Soon after, he began blocking the store’s doors with pallets and other items. Just before 1 a.m. Thursday, with a pair of pistol grip shotguns, he fired 59 shots, police said, killing three of his fellow employees, according to the Press & Sun-Bulletin.

Supermarket employees Terry Sterling, 63, Victoria Brong, 26 and Brian Hayes, 47, died in the shooting, which took place in the small borough of about 1,800 people, located about 30 miles northwest of Wilkes-Barre.

Stair then took his own life, dying of an apparent gunshot wound in his head, the Press & Sun-Bulletin reported.

One other co-worker in the store at the time of the shooting managed to flee and call for help.

On Thursday night, hundreds of people gathered at the Wyoming County Courthouse, about a mile from the supermarket, singing “Amazing Grace” and mourning the three deaths, the Times-Leader reported. Pastors and therapists spoke to the crying community members in the crowd as church bells played the hymn “Faith of Our Fathers.”

It is not entirely clear why Stair chose to kill his three co-workers. Stair apparently did not like the store’s night manager, one of the three people he killed, District Attorney Jeff Mitchell told the Associated Press.

Mitchell described the shooting as “a mental health situation that utterly spiraled out of control,” according to the AP. He added that Stair evoked “extreme loneliness” in his recent writing.

Stair lived with his parents and brother 30 miles away from the store in Dallas, Pa., local news outlets reported. A prosecutor told the AP that Stair texted his mother minutes before shooting, while she was asleep.

The extensive cache of videos and messages Stair uploaded to his Twitter account before the killings were posted under the name Andrew Blaze, which is also how he identifies himself in the recordings, the AP reported.

The Twitter account’s bio states: “I had to die in order to truly live. Speaking from before and beyond the grave. Just because I think you’re okay today doesn’t mean I won’t hate you tomorrow.”

The videos give a window into the life of a troubled man who appeared to live in a fantasy world and who carefully planned a shooting for months. One semi-animated film he posted on Twitter appears to idolize the two teenagers who fatally shot 13 people in the 1999 massacre at Columbine High School in Littleton, Colo.

A lengthy video filmed in May showed Stair describing what he called an “ingenious” plot to “do as much damage as I can.” He sounded calm and decisive as he talked about how he would block the store’s exits, and how certain employees would be on a break outside at that point in the night.

Stair had worked at the supermarket for nearly seven years, and his overnight shift meant he had access to keys and alarm codes.

“I want this to be on the surveillance cameras so you can see it,” Stair said.

He explained how he would execute the shooting, and whom he would kill. He kissed the barrels of his two shotguns and talked about his desire to take his own life.

“I’m going to feel like more powerful than I ever have in my life,” he said. “There’s not going to be anyone that’s going to be able to stop me.”

At the end of the video he asks viewers the question: “What’s going to happen in the future after this to prevent this from happening again?”

“The answer is you can’t prevent it,” Stair said. “You can only endure it.”

More from Morning Mix:

How tech sleuths cracked the mysterious code that turns your printer into a spying tool

The frantic online search for Comey’s professor friend at Columbia Law School

Judge denies bail for accused NSA leaker Reality Winner after not guilty plea

Nicole Kidman on ‘Big Little Lies’ abuse scene: ‘I just felt completely humiliated and devastated’