Generally, a uncoerced confession to officers isn't inherently illegal, but its admissibility in a trial is a tricky matter. The key factor is whether it was obtained fairly. Police must adhere to specific guidelines, https://panchanandshaw.com/blog/contested-divorce-vs-mutual-divorce/