Generally, a voluntary admission to police isn't immediately illegal, but its use in court is a complicated matter. The essential factor is whether it was obtained properly. Police must adhere to specific rules, https://panchanandshaw.com/blog/contempt-notice-explained/