Image copyright South Wales Police Image caption South Wales Police uses facial recognition technology to search for suspects in crowds

A three-month trial of a new police facial recognition app which prompted a legal challenge will get under way this month.

South Wales Police has said it will give 50 officers the app.

The force's use of facial recognition technology prompted a legal challenge by a man whose picture was taken by officers while he was out shopping.

Some other forces have already trialled the technology including the Metropolitan Police.

The BBC has learned that the app uses facial recognition technology provided by the Japanese firm NEC, but that the software's user interface was designed in-house by the police force itself.

Civil rights group Liberty said it was "shameful" the South Wales force was using the technology while court cases were ongoing.

Officers have been using automatic facial recognition (AFR) technology to map faces in a crowd by measuring the distance between facial features, then comparing results with images on a "watch list".

Deputy Chief Constable Richard Lewis said: "This new app means that, with a single photo, officers can easily and quickly answer the question of 'are you really the person we are looking for?'.

"Officers will be able to access instant, actionable data, allowing to them to identify whether the person stopped is, or is not, the person they need to speak to, without having to return to a police station."

The new technology would be used when "necessary and proportionate to do so", he added.

Police and crime commissioner Alun Michael said he was "committed to protecting human rights as well as keeping the public safe".

Hannah Couchman, of Liberty, said: "It is shameful that South Wales Police are rolling out portable facial recognition technology to individual officers while their so-called pilots are being challenged by Liberty in court.

"Far less intrusive means have been used for decades by police to establish a person's identity where necessary.

"This technology is intrusive, unnecessary, and has no place on our streets."

The legal challenge to South Wales Police's use of the technology has yet to be ruled on by a judge at Cardiff High Court.