On 16 February 2009, the Counter-Terrorism Act 2008 (Commencement No.2) Order 2009 brought in to force section 58A of the Terrorism Act 2000 (inserted by section 76 of the CTA 2008), offences relating to information about members of the armed forces etc.
Section 58A makes it an offence to publish, communicate, elicit or attempt to elicit information about any of such persons which is of a kind likely to be useful to a person committing or preparing an act of terrorism. Contrary to some media and public misconception, section 58A does not make it illegal to photograph a police officer, military personnel or member of the intelligence services.
On the 18 August 2009, the Home Office published the following information via its website to clarify photography in relation to section 58A.
Photography and Section 58A of the Terrorism Act 2000
The offence concerns information about persons who are or have been at the front line of counter-terrorism operations, namely the police, the armed forces and members of the security and intelligence agencies.
An officer making an arrest under section 58A must reasonably suspect that the information is of a kind likely to be useful to a person committing or preparing an act of terrorism. An example might be gathering information about the person’s house, car, routes to work and other movements.
Reasonable excuse under section 58A
It is a statutory defence for a person to prove that they had a reasonable excuse for eliciting, publishing or communicating the relevant information. Legitimate journalistic activity (such as covering a demonstration for a newspaper) is likely to constitute such an excuse. Similarly, an innocent tourist or other sight-seer taking a photograph of a police officer is likely to have a reasonable excuse."
I'm not sure I feel that's quite the 'innocent until proven guilty' tradition of UK law...