Usually eavesdropping requires not telling people that you’re spying on them, but one Illinois man reportedly decided to go the other way when police arrived at his home – and he found himself in handcuffs for it.

Police in New Lenox, Illinois said they recently responded to a report of a domestic disturbance at the home of 25-year-old Daniel Murphy, Patch.com reported. During the officers’ investigation at the home, though, Murphy decided to secretly record the officers.

“While handling the domestic, Murphy informed the officers that he was surreptitiously recording the officers,” police said to Patch.

According to WJOL News, Murphy was taken to the Will County Adult Detention Facility, where he was charged with misdemeanor assault and felony eavesdropping without consent.

He was also later charged with aggravated battery to a peace officer and a misdemeanor false report to a public safety agency, though it’s unclear if these charges were related to the alleged eavesdropping incident or the domestic disturbance complaint.

Murphy’s secret recording of officers potentially runs afoul of laws that generally make Illinois an “all-party consent” state, meaning that recordings of private or electronic communication cannot be legally conducted without the consent of everyone involved in the communication.

In March 2014, however, the restrictive nature of the law was highlighted after the American Civil Liberties Union sued over charges made against individuals who were publicly recording police officers on duty. The Illinois Supreme Court ruled that the law violated free speech rights by barring the recording of public conversations, a decision that was upheld when the US Supreme Court declined to hear an appeal.

Since then, state lawmakers have signed into law an amendment that allows for recordings of public conversations but still requires the consent of all parties when it comes to monitoring private conversations and electronic communication.

Under the new law, “surreptitious” recording is still considered illegal, and that is what Murphy has been accused of. The law defines“surreptitious” as recordings “obtained or made by stealth or deception, or executed through secrecy or concealment.”