After judge rebukes police and prosecutor, defendant enters