A gunman wearing a bulletproof vest and "lying in wait" killed three officers responding to a domestic disturbance call, turning a quiet street into a battlefield.
Police chief Nate Harper said the motive for the shooting in Pittsburgh, Pennsylvania, was not clear, but friends said the gunman had recently been upset about losing his job and feared the Obama administration was poised to ban guns.
Richard Poplawski, 23, met officers at the doorway and shot two of them in the head, Mr Harper said. An officer who tried to help the two was also killed.
Poplawski, armed with an assault rifle and two other guns, then held police at bay for four hours as the fallen officers were left bleeding nearby, their colleagues unable to reach them, according to police and witnesses.
More than 100 rounds were fired by the elite police teams and Poplawski, Mr Harper said.
The three murdered officers were Eric Kelly, 41, Stephen Mayhle, 29, and Paul Sciullo III, 37. Mr Kelly had been on the force for 14 years, Mr Mayhle and Mr Sciullo for two years each. Another officer, Timothy McManaway, was shot in the hand and a fifth broke a leg on a fence.
Poplawski had gunshot wounds in his legs but was otherwise unharmed because he was wearing a bulletproof vest, Mr Harper said. He was charged with three counts of murder, aggravated assault and a weapons offence.
The shooting happened just two weeks after four police officers were shot dead in Oakland, California, in the deadliest day for US law enforcement since the attacks of September 11 2001.
Yesterday's victims were the first Pittsburgh city officers to die in the line of duty in 18 years.
At 7am local time, Officers Sciullo and Mayhle were answering an emergency call from Poplawski's mother, who remained hidden in the basement during the entire dispute and escaped unharmed, Mr Harper said.
When they arrived, Officer Sciullo was immediately shot in the head. Officer Mayhle, who was right behind him, was also shot.
"It appears he was lying in wait for the officers," Mr Harper said.
Officer Kelly, who was on his way home after an overnight shift when he heard the call for help, rushed to the scene and was killed trying to help the other two, Mr Harper said. Elite police teams and other officers arrived and were immediately fired on.
Don Sand, who lives opposite Poplawski, said: "They couldn't get the scene secure enough to get to them. They were just lying there bleeding."
Deputy police chief Paul Donaldson, who lives nearby, was one of the first officers to arrive. He saw Officer Mayhle by a bush to the right of the door; Kelly was in the street and Officer McManaway, his hand injured, was kneeling beside him, yelling that Officer Kelly needed help.
Mr Donaldson suggested using a police van to get them. They draped a bulletproof vest on the window to protect the driver and several officers got into the van to get Officers Kelly and McManaway.
During this time, Poplawski was somehow distracted, Mr Donaldson said.
"We were fortunate that he didn't fire on us. I don't know why he was distracted, but he apparently didn't see us coming down to get them," he said. "It could have been worse."
Poplawski had feared "the Obama gun ban that's on the way" and "didn't like our rights being infringed upon", said Edward Perkovic, 22, his best friend.
Mr Perkovic said he got a call at work from Poplawski in which he said: "Eddie, I am going to die today. ... Tell your family I love them and I love you."
Mr Perkovic said: "I heard gunshots and he hung up. ... He sounded like he was in pain, like he got shot."
Poplawski had once tried to join the Marines, but was kicked out of boot camp after throwing a food tray at a drill sergeant, Mr Perkovic said.
Poplawski had been made redundant from a glass factory earlier this year, said another friend, Joe DiMarco.
Poplawski had often fought with neighbours and had even got into fist fights with an unnamed couple in the neighbourhood, Mr Sand said.
"This is a relatively really quiet neighbourhood except for him," he said. "He was just one of those kids that we knew to stay clear from."
Mr Harper confirmed police had responded to calls from the Poplawski house several times but said the incidents were still being investigated.