Pennsylvania State Police have charged a man for his role in the attempted robbery where another man was shot and killed by troopers in an undercover investigation at the Union City.

Robert Hull, 30, has been charged with conspiracy to commit robbery. Investigators said he was staged near the Dollar General with the intent of picking up the victim after the robbery.

It happened in the parking lot of the Dollar General on Route 8 just outside Union City around 4 p.m. Wednesday.

The victim, who has been identified as Keith Hawley, 27, was shot during a controlled purchase of a suspected stolen chainsaw.

Troopers administered first aid, but Hawley was pronounced dead at the scene.

The chainsaw was posted for sale online, and troopers contacted Hawley to arrange the purchase as part of an undercover investigation, according to State Police.

Hawley got into the van with two undercover troopers, indicated it was robbery and pulled out a handgun, investigators said. A struggle then ensued, and Hawley was shot.

Both troopers have been place on administrative leave as part of the protocol for officer-involved shootings. Erie County District Attorney Jack Daneri said the troopers involved will be interviewed in the next few days.

Evidence is being pulled from the van. Investigators are also reviewing video from businesses along Route 8 near the Dollar General.

Hull is behind bars in the Erie County Prison on $50,000 bond.

An autopsy on Hawley is set for 11 a.m. Thursday.