A Florida man was arrested in a women’s supermarket restroom Wednesday after attempting to take a cellphone video of a plain-clothed female detective in an adjacent stall, police said.

The Tampa Bay Times reported that 28-year-old James Michael McEwen was under surveillance when he drove to a Publix supermarket in Riverview, a suburb of Tampa. McEwen was a suspect in another case of video voyeurism, according to the Hillsborough County Sheriff's Office.

Police said that after McEwen walked into the women's restroom and sat in a stall, the detective sat in an adjacent stall, locking the door behind her. She reported that she could see McEwen's shadow as he appeared to record her with his cellphone, the Times reported.

The detective arrested McEwen on a charge of video voyeurism. After the arrest, he acknowledged that he had taken video of the detective without her permission, the agency reported.

McEwen was released from jail Thursday on $2,000 bond, sheriff’s officials said.