Staff at polling stations have been told to stop people taking selfies - even though it is not against the law.

The Electoral Commission fears the craze for taking self-portraits on phones and posting them on social media threatens the secrecy of the ballot.

Anyone who inadvertently reveals how someone else votes in Thursday's local and European elections could face a £5,000 fine or six months in prison.

Staff have been urged to put up "no photography" signs in polling stations.

Some have also received training in what a selfie is - and what to do when they spot someone about to take one in or around a polling booth.

There are elections across the UK to the European Parliament on Thursday and elections to 161 councils in England and 11 in Northern Ireland. Voting takes place from 07:00 BST to 22:00 BST.

Results for the local elections will come on Friday. Results for the European elections will be announced late on Sunday. You can follow full coverage with all the latest updates at http://www.bbc.co.uk/news/events/vote2014

"We have told staff that if they see anyone taking a photograph they should ask the person to delete it but not try to wrestle the phone out of their hands," said an electoral services manager at an East of England local authority.

"It would depend on exactly what they were taking a photograph of. We have told them to take a note of the names and addresses of anyone doing it. But we would not necessarily call the police."

She said staff would also make sure polling booths had open backs so they could see what was happening - and had been told to put up "no photography" signs outside and inside the polling station.

Image copyright PA Image caption Politicians have had to pose for numerous selfies during campaigning

Under Section 66 of the Representation of the People's Act it is a criminal offence to communicate information about the way someone has voted or is about to vote - or to communicate the unique identification number on the ballot paper.

The Electoral Commission fears people taking selfies could accidentally reveal details about how they, or someone else, has voted, potentially putting them in breach of the Act.

But John Turner, chief executive of the Association of Electoral Administrators, said the law was not clear and needed to be updated for the 21st Century.

"There is not an Act of Parliament that says you should not take a selfie inside a polling station," he told BBC News.

"This is essentially a piece of Victorian legislation and they didn't have mobile phones back then."

Image copyright AP Image caption Costa Rica presidential candidate Luis Guillermo Solis, took a selfie after voting earlier this year

Pressed on how he interpreted the law, he said taking a selfie and not showing it to anyone before polling stations closed would probably be within the law, but if they took a picture of the ballot paper "and rushed outside and put it on Facebook" they would be risking prosecution.

But, he added, it would be up to the police and the Crown Prosecution Service to decide whether to prosecute an individual.

"We are all up to our knees in the mire trying to work out what is against the law," said Mr Turner, but he added the best advice to anyone thinking of taking a polling booth selfie was that it was "not worth the risk".

In its guidance to election administrators, the Electoral Commission said: "The law relating to obtaining information in polling stations and disclosing such information is complex.

"Given the risk that someone taking a photo inside a polling station may be in breach of the law, whether intentionally or not, our advice is that you should not allow photos to be taken inside polling stations."

The Law Commission said it was reviewing all legislation on the way elections are conducted, including rules about secrecy and whether photography should be allowed, with a view to simplifying and updating them. It is due to publish proposals in the autumn, for consultation, ahead of a draft bill in 2017.