The primary role of the coroner is to investigate deaths that are sudden, unexplained, or occur under certain circumstances, ensuring that the cause of death is accurately determined and that the deceased are treated with dignity.