A Belfast resident has won a case at the UK's highest court over the failure of Northern Ireland police to prevent union flag protests.
Five Supreme Court justices in London ruled unanimously in favour of the unnamed resident, announcing that the police did have the legal power to stop the parades.
Mass loyalist demonstrations, some of which descended into serious violence, were staged across Northern Ireland in opposition to Belfast City Council's decision to limit the number of days the union flag flew over City Hall.
In April 2014, a judge at the High Court in Belfast ruled in favour of the resident of the nationalist Short Strand area of east Belfast, who claimed the police's failure to stop unnotified loyalist marches past his home between December 2012 and February 2013 breached his right to privacy and family life.
Later that year, appeal judges overturned the ruling following a challenge by the Police Service of Northern Ireland (PSNI).
The resident then took his case to the Supreme Court.
On Wednesday, the justices said the PSNI had "misconstrued" its legal powers to stop parades passing through or adjacent to the Short Strand area.
As permission for the loyalist marches was not sought from the Parades Commission adjudication body, the events were not lawful.
In ruling in favour of the resident, referred to only as DB, the judge at the High Court in Belfast found that police had not properly understood their powers to intervene in the protests.
But three appeal judges, among them Northern Ireland's Lord Chief Justice Sir Declan Morgan, came to a different conclusion and allowed the PSNI's appeal against the judgment.
The PSNI had argued that the original ruling regarding its handling of union flag protests would have placed major constraints on how it polices future parades and demonstrations in the region.
They said commanders' decisions to contain the protests and pursue arrests and charges at a later date fell within their discretionary powers.
But Lord Kerr, giving the ruling of the Supreme Court, concluded: "I would reverse the decision of the Court of Appeal and make a declaration that, in their handling of the flags protest in Belfast during the months of December and January, PSNI misconstrued their legal powers to stop parades passing through or adjacent to the Short Strand area."
Lord Kerr said the flags protest presented the police service with "enormous, almost impossible, difficulties".
They "strove to deal with those difficulties by using different policing techniques and strategies".
A "great many police officers were deployed to police the demonstrations and marches", and a "considerable number of them sustained injuries".
Lord Kerr added: "Assiduous detection of offenders and their prosecution continued throughout this unhappy time."
There could be "no reasonable suggestion" that the police "failed to treat the control of parades and demonstrations with sufficient seriousness".
He pointed out: "This case is not about the sincerity and authenticity of the efforts made by police to control the parades. It is about their conception and understanding of the powers available to them to do so."
The principal issue in the appeal was the question whether PSNI "was sufficiently aware of the full range and scope of those powers".
The Supreme Court said the High Court judge had been right to find that the police "laboured under a misapprehension as to the extent of their powers".
Lord Kerr said: "Difficulties in making policing decisions should not be under-estimated, especially since these frequently require to be made in fraught circumstances."
A spokesman for the PSNI said: "The protracted period of protests, and associated disorder, was a challenging time for everyone in Northern Ireland.
"Throughout the months of the flag protests, the overriding concern of police was always the safety of all communities and the protection of life. We have received a copy of the judgment and will now study it carefully."