entrapment is also a legal term usually used to argue that the defendent would not have committed the crime if it weren't for the pressure of undercover police (or other agents). Such activity by the police is also known as random virtue testing.

Chief Justice Lamar of the Supreme Court of Canada laid down this restriction on police activity in R. v. Barnes (1991):

"...the police may only present the opportunity to commit a particular crime to an individual who arouses a suspicion that he or she is already engaged in the particular criminal activity. An exception to this rule arises when the police undertake a bona fide investigation directed at an area where it is reasonably suspected that criminal activity is occurring. When such location is defined with sufficient precision, the police may present any person associated with the area with the opportunity to commit the particular offence."

In addition, Canadian local Judge P.C.J. Gibson in the case of R. v. Marriott (1996) that "the onus is on the defence...to prove on a balance of probabilities that entrapment occurred"

According to New York State Penal Law Section 40.05 an entrapment defense is valid if "a substantial risk that the offense would be committed by a person not otherwise disposed to commit it".

There is currently an international debate concerning the avoidance of entrapment in police efforts to catch paedophiles online.