There was no known motive for the attack, but investigators said that they found a number of social media posts linked to Mr James that mentioned homelessness and Eric Adams, the New York City mayor.
Mr James claimed to have suffered from post-traumatic stress disorder and a “diagnosis that goes back to the 1980s”.
He described himself on Facebook as being from the Bronx, New York, but appeared to have been living at an address in Wisconsin for some time.
Prior to his arrest, the police released a screenshot of Mr James, taken from a YouTube video that was posted by a channel belonging to the username “Prophetoftruth88”.
In one video, posted on March 1, he criticised Mr Adams for his recent policies to improve safety for commuters by increasing police patrols and expanding mental health outreach programs.