Watch: Why the search warrant was deemed 'unlawful' and what happens next?

Thames Valley Police has accepted warrants it used to search Andrew Mountbatten-Windsor's homes at the time of his arrest in February were unlawful, the High Court has been told.

Following Thursday's hearing, items seized in the raid continue to be held by the police, with a further hearing to take place in 2027 to decide whether the material can be used as evidence.

Meanwhile, the criminal investigation into Mountbatten-Windsor is ongoing.

The former prince, who denies any wrongdoing, was arrested by police on 19 February on suspicion of misconduct in public office, after which he launched a legal challenge over the legality of the search warrants.

The force said it accepted that the "initial court's decision to issue warrants under the specific piece of legislation used was incorrect" before they searched the properties.

On Thursday at the High Court, judge Mr Justice Hilliard said Mountbatten-Windsor and the police had agreed that the search warrants had been unlawful.

However, he added: "The fact that the search warrants were quashed does not bring the investigation to an end or mean that the whole of the investigation is unlawful."

Mountbatten-Windsor opposes the police's bid to retain the evidence, the judge said, and another hearing is expected in 2027.

Mountbatten-Windsor remains under police investigation despite a ruling that the way search warrants were issued was unlawful

His lawyers have used a judicial review to challenge the actions of the force's chief constable and the Central Criminal Court in the build-up to his arrest.

His arrest arose after the US Department of Justice published documents which raised suspicions he had forwarded confidential information to the convicted sex offender Jeffrey Epstein when Mountbatten-Windsor was a UK trade envoy in 2010.

He has consistently denied any wrongdoing in relation to Epstein.

The court heard on Thursday that Thames Valley Police seized documents and electronic devices when they raided Mountbatten-Windsor's homes earlier this year.

Thames Valley Police's position was that they had applied for search warrants under section eight and nine of the Police and Criminal Evidence Act 1984 at a hearing at the Central Criminal Court the day before the search.

That court determined that only section eight search warrants were needed and they were granted on that basis - but subsequently, a legal challenge has established that the court should have issued them under the section nine.

The judge explained on Thursday why the police could keep hold of the former prince's items that had been seized.

He said: "There would be little point in handing property back if it could then simply be lawfully seized under some other provision."

A Thames Valley Police spokesperson said: "The agreement that led to the quashing of the warrants relates specifically to a decision made by the court regarding the legal basis for these and is not a judgement on our ongoing investigation.

"We ensured the court was presented with all the necessary information and paperwork to inform their decision, following the correct legal processes throughout.

"We accept the position that the initial court's decision to issue warrants under the specific piece of legislation used was incorrect and therefore these must be legally quashed.

"Legal proceedings are currently ongoing to decide how material seized during the searches will be managed and whether we can lawfully retain it in support of our ongoing investigation."

The force said its "investigation into alleged misconduct in public office by a man in his 60s from Norfolk remains ongoing, and we continue to pursue all reasonable lines of enquiry to effectively and fairly progress this investigation".

The next stage in this legal dispute will be a behind-closed-doors hearing over whether the police can still retain material seized from Mountbatten-Windsor's homes under alternative powers designed for situations like this.

The error that has led to Thames Valley Police accepting the search warrants were unlawful relates to the particular power the judge permitted the force to use when its officers raided the properties.

Strict legal safeguards on searches bar the police from automatically seizing sensitive material without thinking through in advance the need to take it.

Examples of that material include advice from a suspect's lawyer or material which does not really belong to them, such as copies of confidential work-related papers from an employer.

In practice, if the police find such material during a search, they should return it rather than use it in their investigation.

The category of search warrant that was granted by the court in this instance did not take into account the possibility of such protected material being seized.

However, the law says police can in fact seize that kind of material - or potentially retain it in the event of an error - providing they pass some extra tests.

Thames Valley Police must now convince a judge that the material is likely to be of "substantial value" to their investigation into Mountbatten-Windsor and, ultimately, potential evidence to present to a court.

So while the force has conceded the search warrant was unlawful, a judge will have to decide whether this alternative search power, with its extra safeguards, justifies them keeping and using the material after all.