Generally, a free statement to officers isn't immediately invalid, but its use in court is a complicated matter. The key factor is whether it was obtained legally. Police must adhere to specific rules, including https://panchanandshaw.com/blog/costs-in-pil-explained/