The man whom police say murdered two NYPD officers as they ate lunch in their patrol car Saturday had a violent criminal history and may have been mentally ill.

Court documents show that Ismaaiyl Brinsley, 28, had been arrested in Ohio for theft and robbery, and in Georgia for robbery, shoplifting, carrying a concealed weapon, disorderly conduct and obstruction of a law enforcement officer, according to WABC.

The New York Times reports that Brinsley was convicted on weapons charges in Georgia in 2011 and served two years in prison there.

In total, Brinsley was arrested 19 times in Georgia and Ohio, according to the Associated Press. He'd also had trouble with the law in Brooklyn, where his family still lives.

"The family is grieving and they're still trying to cope with what's happening. It was an estranged relationship," Tony Lindsey, a friend of Brinsley's mother, told WABC. The suspect's sister, who lives in Georgia, told The New York Times that she had not seen her brother in two years.

NYPD Chief of Detectives Robert Boyce told the Associated Press that Brinsley's childhood was so troubled and violent that his mother was afraid of him. He said investigators have learned that the gunman harbored "self-despair and anger at himself and where his life was," which often manifested itself in online screeds against police and government, and that he'd tried to hang himself a year ago.

Brinsley allegedly shot his girlfriend in Baltimore early Saturday morning, then traveled to New York with the intention of killing police officers, New York City Police Commissioner William Bratton said in a press conference Saturday night.

Before the shooting on Saturday, Brinsley allegedly posted threats against police on social media, saying he was going to "put wings on pigs today" as revenge for Eric Garner and Michael Brown, unarmed black men who died at the hands of police.

The Associated Press reports that Brinsley asked people on the street just before the shooting to follow him on Instagram and told them to "watch what I'm going to do."

Investigators are now trying to determine if Brinsley had attended any protests for Garner or Brown, or if his ambush of uniformed officers in broad daylight was a final act of rage and despair.

Police said Brinsley walked up behind a squad car in Brooklyn on Saturday and fired shots inside, striking Officers Wenjian Liu and Rafael Ramos. He then ran to a nearby subway station and took his own life. The officers were pronounced dead at Woodhull Hospital.

NYPD detectives traveled to Baltimore Saturday night to look into Brinsley's past and investigate his alleged ties to a prison gang that has advocated violence against cops.

Groups critical of heavy-handed policing were swift to condemn the attack. Black Lives Matter, an organization that has staged protests in response to recent grand jury decisions not to indict officers in the deaths of black men, released a statement Saturday calling the shooting a murder.