According to the NYPD, before carrying out the shootings, 28-year-old Ismaaiyl Brinsley questioned two bystanders on the street about their gang affiliation, asked them to follow him on Instagram and then said, 'watch what I'm going to do,'" New York Police Department's Chief of Detectives Robert Boyce said during a news conference on Sunday.
PHOTOS: 2 NYPD officers shot, killed
Criminal records show Brinsley had been arrested at least 19 times on various charges in Georgia, including robbery, shoplifting, carrying a concealed weapon, disorderly conduct and obstruction of a law enforcement officer.
In Ohio, he had been arrested for theft and robbery. Brinsley was born in New York and has prior arrests in Brooklyn also, officials said.
NYPD detectives were looking into Brinsley's background, including possible gang activity. His family told police he suffered from undisguised mental problems and that he tried to hang himself last year.
Early Saturday, NYPD Commissioner Bill Bratton said, Brinsley went to the home of a former girlfriend in the Baltimore area and shot her in the abdomen. The victim, identified as 29-year-old Shaneka Nicole Thompson, remains in critical but stable condition. New York police were interviewing her Sunday afternoon.
Baltimore County police said they noticed Brinsley posting to Thompson's Instagram account about a threat to New York officers. Baltimore-area officials sent a warning to New York City police, who received it around the time of the shooting, Bratton said.
Police said he approached the passenger window of a marked police car and opened fire, striking Officers Rafael Ramos and Wenjian Liu in the head. The NYPD officers were on special patrol doing crime reduction work in the Bedford-Stuyvesant section of Brooklyn.
Bratton said Brinsley's last-known address was Georgia, but he had some ties in Brooklyn.
Brinsley wrote on an Instagram account before Saturday's shootings: "I'm putting wings on pigs today. They take 1 of ours, let's take 2 of theirs," officials said. He used the hashtags Shootthepolice RIPErivGardner (sic) RIPMikeBrown.
Bratton said the suspect made very serious "anti-police" statements online but did not get into specifics of the posts.
VIDEO: Candlelight vigil set for slain NYPD officers
Brinsley's mother was distraught after learning of the shooting, according to Tony Lindsey, her property manager.
"Pretty much finding out about this whole thing on social media, which is horrible, so she's asking that everyone respect her privacy right now," Lindsey said. "The family is grieving and they're still trying to cope with what's happening. It was an estranged relationship."
Brinsley's mother said that her son had a troubled childhood, was often violent and that she feared him.
Meanwhile, the Los Angeles Police Department is showing solidarity with its New York City police family. Los Angeles police officers will be wearing black bands on their badges to support the fallen NYPD officers.
LAPD Chief Charlie Beck announced the move just hours after the murders.
Our hearts go out to the entire #NYPD family as they mourn the tragic loss of two brothers.— Chief Charlie Beck (@LAPDChiefBeck) December 20, 2014
For full coverage on the NYPD police shooting, click here.
ABC News, WABC, and The Associated Press contributed to this story.