Okay, first, racism exists and is alive in America and other countries.
Second, "average racists"...if such a personality type can be said to actually exist...don't go into churches and shoot a bunch of people. Just as "average homophobes" don't shoot up gay pride parades and "average misogynists" don't stalk and kill women. Mentally ill people do that.
Now, mentally ill people just don't sit around all day talking to themselves. They go on the internet. They go to work. They go to meetings. And they get exposed to other people's viewpoints, such as racism, homophobia, and misogyny. Sometimes, they agree with these points of view and adopt them as their own. However, unlike their more "average" counterparts, they take things beyond the extreme. I think it is safe to say that if they were not exposed to other people's more average racist (or homophobic, or misogynist, etc.) beliefs, they would have latched on to some other extremist point of view, and put their own extra-extreme spin on it. Their minds are telling them that someone or something is against them and everything they believe in, that they are under constant threat that they must defend themselves from, that they are the chosen leader to save the world from the terror of.....something. It's up to their life experiences to fill in what that "something" will become. In this guy's case, it was apparently black people. At some point in his life he met some "average" racists who shared their beliefs with him. To him, it was like a revelation. These people understood! They knew about the terror that was coming! Of course it was black people that were the root of it! These average racists provided confirmation through their own opinions of everything his mind had been telling him all along! The problem was that they weren't "chosen". They couldn't see things as well as he could. They couldn't know what had to be done to stop this lingering menace. He understood because he was special. He couldn't be afraid of the long arm of the law, or the sting of "public opinion", or what it might do to all his friends and family - He had been given a special purpose.
Racism meets irrational thought.
So, would this guy have shot up a black church without racism? Maybe. He probably would have shot up something. Maybe a daycare, or a government building, or a government building with a daycare inside it (I don't believe anyone's ever accused Timothy McVeigh of racist actions). So, is racism to blame? Yes. Is mental illness to blame? Yes. Is lax gun control to blame? Yes, it is. Hey, I know a lot of pro-gun people, and there's not one of them who thinks its a good idea to let mentally unstable folks have easy access to firearms.
So the point is you can't narrow this tragedy down to being the result of one, or even just two, causes. You can't use it as a rallying cry against just racism, or just mental illness, or just guns, or...as some pundits have been doing...claim it's a result of the "criminalization of Christianity". There were many failures that lead to this; failures of government, failures of social contract, etc. Improving one aspect might have prevented it, but it might not. Improving all those aspects would be more likely to prevent it, but it still might occur. Sometimes, there's nothing you can do to prevent a tragedy. But that doesn't mean you shouldn't try. That doesn't mean we shouldn't try to educate people away from racism, or that we shouldn't improve healthcare for the mentally ill, or that we shouldn't consider rational means of gun control. We should. We need to.
What we should not do is waste our time pointing fingers at who or what is to blame. Ultimately, this kid is to blame. Now lets work on making sure there are no more kids that turn out like him in the future.