Bensalem Police have arrested two Philadelphia men who allegedly tried to rob and shoot an undercover narcotics officer Tuesday during a buy-and-bust operation gone bad.

Officials with the Bensalem Special Investigations and Criminal Investigations units were conducting a drug sting near the 2300 block of Lincoln Highway at about around 5:45 p.m. An undercover Bensalem officer made arrangements to buy 300 oxycodone pills with an estimated street value of between $7,000 and $9,000.

Investigators said reputed drug dealer Tariq Moore, 29, pulled up to the area in a car whose registration plate was partially covered with duct tape, apparently in an attempt to avoid detection. When the officer posing as a buyer got into the vehicle, he allegedly saw someone - later identified as David McCoy, 25 - hiding under a blanket in the backseat. 

Police said the officer, feeling he was about to be robbed, immediately got out of the car. Moore also got out of the car, but allegedly only gave the cop about half of the drugs owed. 

That's when things got heated, according to authorities, who allege Moore became "argumentative" with the officer and turned toward the vehicle, saying, "Klack 'em." The phrase is a "common term used by gang members, meaning to 'shoot him,'" according to a news release.

The officer said he saw McCoy climb out of the car's middle seat area and get into the back trunk, where a later search allegedly revealed a loaded handgun was stored. Moore then handed the officer bags stuffed with several different kinds of pills in exchange for the rest of the money, according to investigators.

Still, Moore apparently remained unsatisfied — police said he again turned to the vehicle and could be heard saying, "Klack 'em." The officer, fearing he was going to get shot, came clean and identified himself as a law enforcement official.

But that wasn't the end of the ordeal. While police waited for backup, Moore allegedly ran back inside the car and tried to speed away. Investigators said he backed up and slammed into two detectives arriving in a police vehicle. He then kept accelerating, spinning the car's tires in a futile attempt to escape, according to authorities.

More officers soon converged on the area, barring Moore and McCoy from making a getaway and ordering both men out of the car. "However, McCoy was observed jumping back and forth between the rear passenger compartment and the rear trunk compartment," officials said in a release. Police eventually got the two suspects out of the vehicle and detained them. A search of the car allegedly turned up duct tape, rope and, stashed in a compartment in the trunk area, a loaded .40-caliber handgun that was reported stolen in September after a Philadelphia burglary.

The suspects allegedly admitted during an interview at the police station they planned to "rip off" the drug buyer by selling fake pills. Police said Moore was tasked with handling the transaction, while McCoy was supposed to lay under the blanket inside the car and, if the sale didn't take place, jump out from underneath and rob the buyer.

McCoy and Moore were arraigned Wednesday via video. Moore, of the 4700 block of Sansom Street in West Philadelphia, is charged with solicitation to commit murder, conspiracy to commit robbery with a firearm and drug delivery. McCoy, of the 6500 block of North Woodstock Street in West Oak Lane, is charged with conspiracy to commit robbery with a firearm, drug delivery and possessing a stolen firearm.

Moore was sent to Bucks County Prison in lieu of 10 percent of $1 million bail, while McCoy was remanded in lieu of 10 percent of $750,000.

The undercover officer was unharmed, though police said the two detectives in the vehicle that was rammed suffered minor injuries. They were treated and released from an area hospital and are expected to return to full duty in several days.