Cressida Dick, the Metropolitan Police commissioner, said that officers had a duty of confidentiality even after they had left their posts

Britain’s most senior police officer has warned that retired detectives commenting publicly about pornography allegedly found on a cabinet minister’s computer risk prosecution.

Cressida Dick, the Metropolitan Police commissioner, said that officers were wrong to discuss material found on a Commons computer belonging to Damian Green, the first secretary of state, in 2008. Ms Dick insisted that officers’ duty of confidentiality continued after they had left their posts.

Mr Green, who is the subject of a Cabinet Office inquiry, has denied that he downloaded or watched the content on the computer, which has been described by at least one officer as “extreme”.

Ms Dick told LBC radio: “Police officers have a duty of confidentiality. We come into contact with personal information very regularly, sometimes extremely