Generally, a uncoerced admission to officers isn't automatically illegal, but its acceptance 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/confession-before-police-is-it-valid/