I'm not sure he had a "motive". According to a news report last night he's been in trouble before including trying to gouge out a police officer's eyes. He has also previously been found mentally unfit to be held accountable for a crime.
I think the attack boils down to the guy is crazy. As such, he should not be allowed to roam around in public.