The video is in color and explicit.

It shows hours and hours of male customers having sex with masseuses inside a South Florida massage parlor. Police installed hidden cameras inside the business to capture prostitution on tape.

And it's legal.

The footage, obtained by CNBC, is from a 2015 South Florida massage parlor investigation where police installed hidden cameras after hiring a locksmith to get inside the business in order to capture prostitution taking place in the rooms. The spa later shut down after police arrested dozens of customers. Police were able to install hidden cameras after obtaining a special warrant.

The technique was used recently in a sweeping human trafficking investigation in South Florida in which New England Patriots owner Robert Kraft was among those arrested. In the investigation, hidden cameras were used to capture Kraft on video inside the Orchids of Asia Day Spa in Jupiter, Florida, police records show. Kraft, 77, has pleaded not guilty to two counts of solicitation.

"From the attorney general of the state of Florida to other law enforcement agencies that have contacted us, and me personally, the question is, how in the world did you do this?" Martin County Sheriff William Snyder told CNBC.

The answer: delayed-notice search warrants, better known as sneak-and-peek warrants.

The warrants allow law enforcement to secretly install hidden cameras inside private businesses to monitor illegal activity.

In the current human trafficking investigation that ensnared Kraft, Florida police have made more than 300 arrests in Martin, Indian River and Palm Beach counties. Hidden cameras were installed in five of the eight spas under investigation, police said.

"From the inception of the investigation, it was clear to us that unless we were able to get inside the massage parlor and actually see what was going on, we would never be able to affect what I've been calling from the very beginning a rescue mission of the women that we thought were being trafficked," Snyder said.

He said detectives conducted extensive surveillance outside the spas and gathered evidence to get a judge to allow the sneak-and-peek warrant.

2015 hidden camera police footage inside a Florida day spa. Police surveillance video

"So once we had all the information, we had the evidence — and we had a mound of evidence prior to the court-ordered surveillance," he said. "We took that information and went to a judge … And there was no other way to complete this investigation without having the court order in place. And so the judge gave us the order, we installed the cameras, and as a result, we did find that it was an active, ongoing criminal enterprise in that massage parlor."

Martin County detectives posed as employees of other occupations to get access to the massage parlors to install hidden cameras, Snyder said.

"We did not go in as law enforcement, and did not do any covert breaking and entering. Everything was a ruse," he said.

Detectives monitored the video on flat-screen TVs inside a secure room in the Martin County Sheriff's Office.

Details about how Jupiter police entered Orchids of Asia Day Spa to install hidden surveillance cameras were revealed in three search warrants related to the case unsealed on Friday.

"A tactical ruse was conducted at the target business to remove the current occupants and install covert video surveillance equipment," according to the court documents. Once the two women inside the spa went outside, detectives installed the surveillance cameras inside four massage rooms and in the lobby.

Martin County Sheriff William Snyder. CNBC

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

The owner of the spa arrived at the business while police were installing the cameras, one of the warrants said. It said the owner could see what was happening because she had her own cameras installed inside and was monitoring them on her mobile phone.

Sneak-and-peek history

Sneak-and-peek warrants have been used since the 1970s. They were formalized as part of the USA Patriot Act, which "established a uniform nationwide standard for use of delayed-notice search warrants to ensure an even handed application of Constitutional safeguards for all Americans," according to a 2004 Department of Justice report.

Court data analyzed by CNBC shows that 46,603 sneak-and-peek warrants nationwide were granted between 2006 and 2016.

The use of the warrants has been steadily on the rise, the data showed. In 2006, only 75 granted requests were issued. By 2016, that number had risen to 9,140 — more than a 12,000 percent increase.

Florida ranks as number seven for states with the most search warrants granted, with a total of 1,514 during that 10-year period. California was at the top of the list, with 5,084.

The numbers from 2016 are the most recently available data, which was compiled from the Administrative Office of the United States Courts.

Mike DeMarcus, a retired Florida detective who owns the Atlanta-based Law Enforcement Training Associates, said very few, if any, of the thousands of law enforcement personnel his instructors have trained have ever heard of the sneak-and-peek warrants.

"Of all the people that we've ever trained, we've never had any detective from the federal side or the state side that have come in and said they've been part of a sneak-and-peek warrant," DeMarcus said.

Hidden cameras in a spa are rare

He said many of the warrants issued around the country were likely used to put surveillance trackers on a vehicle. The data show drug investigations generated most of the warrants with sex crimes only accounting for a small amount. And using hidden cameras in a massage parlor case is even rarer, DeMarcus said.

"As far as getting into whether it's a residence or a business, you're going to have a couple people that are experts, as far as getting in, and maybe a locksmith," he said. "It could be an alarm person, who needs to go in and shut down an alarm, or possibly it's a storefront. And if the lock can't be defeated, then you might have to hire a window person to come in, remove a window and allow the surveillance team to go inside and install their equipment."

He said police also have a variety of ruses available such as emptying a business over a supposed suspicious package. This may be critical in a massage parlor investigation where the employees may actually live on the premises.

"The videos or the surveillance will show that it may be all of the employees. It may be one of the employees," he said. "But it is going to actually record the sexual act."

“These videos will show acts of prostitution occurring inside the business. A variety of different actions,” he added. “So the video does actually show that there is sexual activity going on inside these businesses.”

Privacy issues

Jonathan Witmer-Rich, a law professor at the Cleveland-Marshall College of Law at Cleveland State University, has spent years researching delayed-notice search warrants and their potential implications.

"Covert searching definitely raises some serious privacy concerns," Witmer-Rich said.

Cleveland-Marshall College of Law Professor Jonathan Witmer-Rich. CNBC

One major concern, Witmer-Rich said, is that the warrants are at odds with the Fourth Amendment, which guarantees American citizens "the right of people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures."

"Just the fact that the government is in your house, or in your business, and you don't know that they're there, is a real privacy invasion," Witmer-Rich said. "The whole idea of the Fourth Amendment is that some places in our lives, we can retreat back to our homes. We can relax. We can be ourselves and the government's not in there, they're not watching us. A covert search warrant really changes that calculus."

Witmer-Rich also said that using video surveillance to catch customers soliciting prostitution, a misdemeanor, is tangential to proving human trafficking, a felony.

"Recording the sex acts themselves doesn't really get you the evidence you need for human trafficking," Witmer-Rich said.

He said the Supreme Court has never taken a case deciding the constitutionality of sneak-and-peek warrants.

The court ruled, though, in a 1979 case involving the theft of stolen goods meant for interstate commerce, that covert entry is constitutional in some circumstances. The Fourth Amendment does not prohibit per se a covert entry performed for the purpose of installing otherwise legal electronic bugging equipment, the court found.

The court also ruled in a 1990 drug case that delaying notice of a search warrant is permissible if there is "good reason."

Use of warrants questioned

John Wesley Hall, a former president of the National Association of Criminal Defense Lawyers, said sneak-and-peek warrants can be a valuable tool, but that law enforcement officials need a strong case to use them.

"It's really '1984,' except that you don't know the camera is there," said Hall, who wrote a book called "Search and Seizure" and maintains a blog on the Fourth Amendment.

In the case of the Orchids of Asia Day Spa, Hall questioned whether the use of video surveillance was reasonable by a legal standard. For the general public, filming someone in an intimate setting without consent is a crime, he said.

2015 hidden camera police footage inside a Florida day spa. Police surveillance video

He said more appropriate uses for delayed-notice search warrants might be very serious crimes – like murder or organized crime. Prostitution is a comparatively "low-level" offense, he said.

"If a defendant puts cameras in certain places, he's a video voyeur," Hall said. "But if the government does it with a warrant, then they're not video voyeurs ... allegedly."

Four women who worked in the Martin County spas were arrested, but could be eligible for special visas as trafficking victims if they cooperate with authorities, police said.

The spa workers employed at the Orchids of Asia Day Spa routinely walked to and from the Publix grocery store located in the strip mall shopping center, which is as nondescript as any along the southeast Florida coast. An employee at one of the restaurants in the strip mall said the women rarely, if ever, looked up, as if they were in another world.

"They looked miserable," the employee said. "They looked lifeless."