Dylann Roof was allegedly planning to carry out a massacre at a Charleston college.

According to friends of the 21-year-old, he drunkenly told them he was "going to hurt a bunch of people" at a college in Charleston, seven days before he is reported to have opened fire in a church killing nine black worshippers during a bible study class.

Christon Scriven, a black friend of the 21-year-old, said he was so concerned by the outburst that he hid Roof's .45-caliber handgun in the air-conditioning vent of a mobile home.

Roof was given back his weapon days before the fatal shooting, after a girl living in the trailer said she wanted it out of the house.

Mr Scriven told reporters: "I think he couldn't get into the school because of the security ... so I think he just settled for the church."

The 22-year-old described Roof as an extremely unhappy person, who drank heavily because he "felt unloved." He was often between homes, living with one or other of his divorced parents.

His own family have described him as a loner who was increasingly introverted. Other acquaintances said he was a confused and troubled young man who appeared conflicted over his ideas about race. He is said to have partied with his black friends, but would also go on racist rants about African-Americans to his white friends.

"I don't think his parents liked his decisions, the choices that he made to have black friends," Mr Scriven added.

Friends of Roof said that he had often spoken of carrying out a shooting , but they dismissed his drunken ramblings.

Joey Meek, a high school friend said: "Whenever he said he wanted to do something crazy, I just blew it off and didn't pay attention because he was intoxicated."

Dylann Roof entered the Emanuel African Methodist Church on 16 June night as they attended their weekly bible study session. Seconds before the attack, authorities said Roof stood up and announced he was there to "shoot black people." Parishioners pleaded with the gunman not to open fire, but he according to eyewitnesses he said: "I have to do it. You rape our women and you're taking over our country, and you have to go."

He reloaded five times in the course of the massacre. The victims — six women and three men — ranged in age from 26-year-old Tywanza Sanders, a recent graduate of Charleston's Allen University, to 87-year-old long-time church member Susie Jackson.

Dylann Roof Charleston church killings
Dylann Roof, charged with 9 counts of murder, betrays no emotion as the families of victims tell him in court: \'We forgive you\' charlestoncounty

On Friday (19 June) Roof appeared in court via video link. During the hearing, relatives of those killed in the Charleston church shooting addressed him directly expressing their grief and their forgiveness.

One woman who lost her mother in the attack said she forgave Roof, while another grieving relative said "every fibre in my body hurts, and I'll never be the same".

Roof appeared unmoved as he heard their sobs in the courtroom.

The 21-year-old is charged with nine counts of murder and possession of a firearm in connection with the shooting spree at the black church in Charleston, where all of the victims were African-American. He remains in custody.

On Saturday, a "manifesto" which appears to have been written by Roof emerged, outlining the "problems" he claims ethnic groups cause for white Americans.

The website – registered on the 9 February 2015 – is entitled The Last Rhodesian. It's only content is a 110MB compressed file containing photos, and a 2,500 word manifesto filled with racist diatribes

In the rambling text, he describes how he was "never the same" after visiting the websites that detailed white Americans being killed by blacks, and which claim racial problems in Europe are worse, as it is the "homeland of White people".

Authorities, who are already investigating the shooting as a hate crime, said they are now probing it also as a possible "act of domestic terrorism".

The governor of South Carolina, Nikki Haley, has called for Roof to receive the death penalty.

The massacre in the historic African American church was the deadliest attack on a place of worship in the US in 24 years