New York (CNN) -- Officer Rafael Ramos sat in the driver's seat. Officer Wenjian Liu was at his side.

The two cops weren't at their usual precinct -- normally, the pair was assigned to downtown Brooklyn, but they were working a "critical response" detail in an area with higher crime, police said.

That's where they were slain, ambush-style -- Saturday afternoon as they sat in their patrol car, New York Police Commissioner William Bratton said at an evening news conference.

The gunman approached the passenger side of the patrol car and took a shooting stance, witnesses told police. He opened fire several times, striking both officers in the head, Bratton said.

They were "shot and killed with no warning, no provocation," Bratton told reporters. "They were quite simply, assassinated."

The gunman was found dead in a nearby subway station from a self-inflicted gunshot wound.

The thin blue line

The families of the fallen officers rushed to Woodhull Medical Center on Saturday, as dozens of their comrades gathered in a show of support.

Ramos had just turned 40 this month; Liu got married two months ago.

Both dreamed of being police officers, Bratton said.

"One of the unfortunate realities of policing is that you put that blue uniform on and you become part of the thin blue line between us and anarchy," Bratton said.

Mayor Bill de Blasio and Bratton met with the families of the victims. De Blasio said that Ramos' 13-year-old son couldn't comprehend what had happened to his father.

"When a police officer is murdered, it tears at the foundation of our society," the mayor said. "It is an attack on the very concept of decency."

The suspect

Police identified the shooter as Ismaaiyl Brinsley.

He arrived in New York from Baltimore, but had a residence in Atlanta. Bratton said that Brinsley was somehow connected to Brooklyn, but would not discuss that information.

Bratton said at this time, there was no indication Brinsley was connected to any terrorist groups or organized entity.

Police were investigating posts Brinsley allegedly made on social media. Bratton said that the suspect had earlier shot and seriously wounded a woman believed to be his ex-girlfriend in Baltimore.

Baltimore police received information that Brinsley had made threatening comments about police, and sent a warning to police in New York, Bratton said.

That message came almost the same time the ambush happened.

U.S. Attorney General Eric Holder called the attack "an unspeakable act of barbarism."

De Blasio also called the shootings an "assassination."

"It is an attack on all of us," he said. "It is an attack on everything we hold dear."

A White House official says President Barack Obama was briefed on the shooting.

"This can't happen"

The shooting jolted residents in the neighborhood.

"This can't happen. If you mad at somebody, be mad at the person that you are mad at. Now, we have two families that (are) missing somebody for the holidays," Shaniqua Pervis told CNN affiliate WABC.

"Where is your humanity? I know it's a war going on and shoutout to Eric Garner's family and everybody else who lost somebody, but you're not at his house, on his lawn. This is two (officers). You don't even know if (they were) good or bad. I don't condone this, and I'm not with it."

The woman was referring to the controversial July death of the unarmed black man after New York police officers on Staten Island wrestled him to the ground, with one of the officers wrapping his arm around Garner's neck in a chokehold.

A grand jury's decision not to indict the police officer in the Garner case, as well as a separate grand jury's refusal to indict an officer in a controversial police shooting of unarmed teen Michael Brown in Ferguson, Missouri, led to nationwide protests against the police.

Brown's family condemned Saturday's slayings.

"We reject any kind of violence directed toward members of law enforcement. It cannot be tolerated. We must work together to bring peace to our communities," they said in a statement.

"Our thoughts and prayers go out to the officers' families during this incredibly difficult time."

In a statement, activist the Rev. Al Sharpton said the Garner family was outraged by news of the shootings.

"Any use of the names of Eric Garner and Michael Brown, in connection with any violence or killing of police, is reprehensible and against the pursuit of justice in both cases," the statement said. "We have stressed at every rally and march that anyone engaged in any violence is an enemy to the pursuit of justice for Eric Garner and Michael Brown."

Tensions between the community and police have heightened around the country since the deaths of Brown and Garner.

"This could not have come at a worse time," City Councilman Robert Cornegy told CNN affiliate PIX.

So far, police have not commented on the motive for the Brooklyn shootings, except to say the officers were not engaging the shooter in any way when they were shot.

CNN's David Shortell, Mariano Castillo and Kevin Liptak contributed to this report.