Generally, a free statement to officers isn't immediately illegal, but its use in court is a complicated matter. The vital factor is whether it was obtained fairly. Police must adhere to specific guidelines, including https://panchanandshaw.com/blog/court-commissioner-role-explained/