If your Internet service goes down and you call a technician, can you be certain that the person who arrives at your door is actually there to restore service? What if he is a law enforcement agent in disguise who has disabled the service so he can enter your home to look around for evidence of a crime?

Americans should not have to worry about scenarios like this, but F.B.I. agents used this ruse during a gambling investigation in Las Vegas in July. Most disturbing of all, the Justice Department is now defending the agents’ actions in court.

During the 2014 World Cup, the agents suspected that an illegal gambling ring was operating out of several hotel rooms at Caesar’s Palace in Las Vegas, but they apparently did not have enough evidence to get a court-issued warrant. So they enlisted the hotel’s assistance in shutting off the Internet to those rooms, prompting the rooms’ occupants to call for help. Undercover agents disguised as repairmen appeared at the door, and the occupants let them in. While pretending to fix the service, the agents saw men watching soccer matches and looking at betting odds on their computers.

There is nothing illegal about visiting sports-betting websites, but the agents relied primarily on that evidence to get their search warrant. What they failed to tell the judge was that they had turned off the Internet service themselves.