A judge has condemned as a politically-correct disgrace' the attempted prosecution for assault of a "gallant" police officer who arrested a man brandishing a knife.

The incident in Keighley happened within weeks of the fatal shooting of PC Sharon Beshenivsky by robbers in Bradford.

PC Lee Armstrong, 28, who lives in Ilkley, had been due to stand trial at Bradford Crown Court after he denied assaulting the man four days before Christmas 2005.

But yesterday prosecutor Paul O'Shea told Judge Jonathan Durham Hall QC that after considering further information about the alleged complainant it had now been decided that there was no longer "any realistic prospect of a conviction''.

Mr O'Shea said the decision had been taken to offer no further evidence against PC Armstrong, who is understood to have served in the West Yorkshire force for about four years.

Judge Durham Hall said Mr O'Shea had acted in the highest standards of the Bar.

But he said: 'There was never any prospect at all of this gallant, young officer being convicted.

'The conviction of yet another man doing his duty, for reasons that are best described as politically correct, is a disgrace. The Crown will pay every penny of his costs.'' That sum is calculated to be more than £16,000 because the case has run on for nearly two years, but the prosecution can still challenge the ruling.

At yesterday's hearing Judge Durham Hall referred to the officer arresting a knife-wielding man, who along with bystanders verbally abused PC Armstrong.

It is understood that the assault allegation involved the unnecessary banging of the complainant's face on the bonnet of a vehicle.

It was made only a few weeks after PC Beshenivsky, 38, was shot dead as she arrived at the scene of a bungled armed robbery at Universal Express travel agency in Morley Street, Bradford, in November 2005.

At yesterday's hearing, the judge told PC Armstrong: 'I note that this matter took place within a few days of the random shooting of an officer on the streets of this city and I am sure every police officer is right to bear in mind the courts will, whenever possible, recognise the dangers and difficulties of their duties and will commend officers.

'If the boot had been on the other foot I suspect I would have been commending you for your actions."

He added: "You have in my judgment, if your actions are anything to judge by, a very good career ahead of you.

"Icannot imagine what you have felt being pursued and harassed in this prosecution over the last few months and I am very sorry."

Following the court hearing, Tom McGhie, chairman of the West Yorkshire Police Federation also criticised the decision to prosecute PC Armstrong.

He said: "We understand that the public expect extremely high standards from police officers. But it is an awful ordeal for any officer to stand trial. If the CPS had been braver, originally, and made a decision not to bring this to court, this officer would not have had to put up with the stress and worry of a crown court trial in the first place."

A CPS spokesman said a decision would be made in the next few days whether The Crown would contest the judge's ruling to award costs against it.

Nigel Cowgill, Chief Crown Prosecutor, CPS South Yorkshire, which prosecuted the case, said: "It is the duty of the CPS to ensure that the right person is prosecuted for the right offence. All cases are reviewed on their own merits and we treat all individuals the same no matter what their occupation or standing in the community.

"We constantly review cases and in the case of Mr Armstrong new information has come to light recently. This has meant that the CPS no longer felt that there is a realistic prospect of conviction."

PC Armstrong's solicitor, Ian Townsend a partner in Morley law firm Arenalegal, said: "PC Armstrong wishes to thank the public for their support over the past two years which have been a difficult time for both him and his family.

"He is grateful to the Crown Court Judge for confirming what he has always maintained that he was innocent of the allegations made."