A Florida judge ruled Monday that video purporting to show New England Patriots owner Robert Kraft paying for sex acts at a massage parlor is inadmissible at the 77-year-old's forthcoming trial on misdemeanor solicitation of prostitution.

Judge Leonard Hanser wrote that Jupiter police did not follow proper procedures after installing hidden cameras which secretly recorded Kraft visiting the Orchids of Asia Day Spa twice this past January and did not do enough to minimize the invasion of privacy of customers who did nothing wrong.

"The fact that some totally innocent women and men had their entire lawful time spent in a massage room fully recorded and viewed intermittently by a detective-monitor is unacceptable," Hanser wrote in a decision that capped a multi-day pre-trial hearing punctuated by occasional bad-tempered exchanges between prosecutors and Kraft's legal team. The state is expected to appeal.

Kraft, who has owned the Patriots since 1994, is one of 25 men charged with paying between about $50 and $100 for sex at the day spa. He has pleaded not guilty, but issued a public apology for his actions. NFL officials have said they are watching the case, but have not disciplined Kraft. Under league policy, players, owners, coaches and other employees can be punished for "conduct detrimental to the integrity of and public confidence in" the NFL.

Kraft and others were arrested as part of an undercover operation said to be carried out by detectives who watched videos of customers inside the spa. If they saw a customer have sex with an employee, they said they would relay that information to officers in the parking lot and nearby. The officers would follow the customer until he allegedly committed a traffic violation and then stop him, getting his identification so he could be charged later with soliciting a prostitute. The customers were not told at the time that they had been seen inside the spa.

Attorneys for Kraft argued that a warrant authorizing the video surveillance never should have been granted, saying it had no instructions on how to protect innocent people from being caught up in the sting.

"You had people looking at these videos who had no idea what they were doing ... none of the criteria made sense," Kraft attorney William Burck said earlier this month. "That's not because they are bad people. They didn't have instructions. If you have no instructions, the warrant has to go."

Detectives testified that they switched to a different video feed if an innocent customer was getting a legitimate massage. They also said that in several cases where lights in the massage room were turned off, no charges were filed against the patrons even though the detectives strongly suspected sex acts were going on.

The hearing became extra-contentious last week after prosecutors asked Hanser to find Kraft's legal team in contempt of court over attorney Alex Spiro's questioning of Jupiter patrol officer Scott Kimbark, who pulled over Kraft's chauffeur after one of the spa visits to uncover his passenger's identity. Spiro asked Kimbark during the suppression hearing whether he had told other officers that to justify pulling over a customer who left shortly before Kraft he would "make some sh-- up." Kimbark said he didn't remember saying that and didn't think he would.

Spiro ultimately asked the question or a variation of it four times. Prosecutors claimed Spiro knew Kimbark never used that language or said he would concoct a reason to stop the driver, and accused Spiro and Burck of sullying Kimbark's reputation by implying he would lie to justify a stop.

Spiro and Burck wrote in a rebuttal that Spiro's questions accurately reflected Kimbark's actions and were based on the recollections of the other customer's attorney, who had seen the officer's body camera video.

CLICK HERE TO GET THE FOX NEWS APP

Prosecutors have offered to drop the charges if Kraft enters a diversion program for first-time offenders. That would include an admission that he would be found guilty if the case went to trial, a $5,000 fine, 100 hours of community service and attendance in a class on the dangers of prostitution and its connection to human trafficking. Prosecutors have said the fine and community service are required by law and are not negotiable.

Hanser has ordered Kraft to appear in court for a May 21 pretrial hearing. It's unclear how Monday's ruling may affect that hearing.

The Associated Press contributed to this report.