WILKINSBURG, Pa. -- Two gunmen working as a team fatally shot five people and critically wounded two others at a backyard cookout, with one attacker using a high-velocity rifle to shoot all the victims in the head as they were driven his direction, a prosecutor said Thursday.

"The murders were planned. They were calculated," District Attorney Stephen Zappala said.

The gunmen appeared to have targeted one or two of the victims, said Zappala, who said they hadn't ruled out drugs as a motive.

Four women, one of them pregnant, and a man were killed as they rushed toward the back porch and an alleyway to seek cover as a gunman fired a .40-calibre pistol at as many as 15 adults who were playing cards and having a late-night cookout in the yard.

That steered the victims toward the rear porch and door of the house, where an accomplice armed with a .762-calibre rifle similar to an AK47 shot them from behind a chain-link fence less than 10 feet from the porch, Zappala said.

The man with the rifle aimed high throughout the barrage of bullets. Four of the dead were found on the tiny back porch.

"They were all head shots," Zappala said.

The dead included three siblings, Brittany Powell, 27, who a cousin said lived at the home; Jerry Shelton, 35; and Chanetta Powell, 25. The other two were Shada Mahone, 26, and Tina Shelton, 37.

"It looks like right now they were all fleeing toward the backdoor of the residence when the second gunman fired from the side of the yard," said Lt. Andrew Schurman of the Allegheny County homicide unit. "They all seemed to get caught on the back porch."

Carl Morris and his son, Robert, were getting ready to leave their house across the street when they heard a volley of three shots, a pause, then gunfire lasting more than a minute.

Robert Morris said he saw children run onto the small back porch and heard someone scream, "Mommy, Mommy."

"It was terrible," the younger Morris said.

The Morrises said the woman named Brittany lived at the home with a daughter who was about 6 or 7 years old.. They said the house was considered a "safe haven" in the neighbourhood.

The backyard is about 30 feet by 50 feet. Police said they found one pile of shell casings just outside the yard in an alley, where they believe the .40 calibre pistol was fired, Zappala said. They found more shells along a fence that separates the house from a neighbour's yard, which is where Zappala said the assault rifle was fired.

Bullet holes were visible Thursday around the porch addition. Tables and chairs, some tipped over, remained in the backyard, signs of a party quickly abandoned.

The suspects fled on foot.

Wilkinsburg is a poorer, largely blighted suburb just east of Pittsburgh that is known for drug trafficking and gun violence. But neighbours described the street on which the shooting occurred as generally quiet.

After the shooting, groups of residents gathered on the street, some of them sobbing and saying they lost family members.

Mike Jones, 57, has lived in a duplex on a small hill overlooking the alley and backyard where the shooting occurred.

Although Wilkinsburg has a reputation for violence, Jones said it has been rare in his neighbourhood, which is about a block off a major street about a half-mile from Interstate 376, the major commuter artery through Pittsburgh's eastern suburbs.

"This is unheard of," Jones said, shaking his head as homicide detectives milled about in the yard and alley. "It doesn't happen around here."

Allegheny County Executive Rich Fitzgerald urged witnesses to step forward, saying that "can be our first step to stopping the violence in our communities."

"As a community, we must say enough is enough," he said.

12:41ET 10-03-16