The city of New York has agreed to pay $18m to settle a civil rights claim from hundreds of protesters who were rounded up and detained in overcrowded and dirty conditions after they rallied outside the 2004 Republican National Convention.

The settlement, between city hall and almost 500 individuals, brings to an end a long-running sore between the overwhelmingly peaceful protesters and the New York police department (NYPD) that had been pursuing aggressive surveillance and detention tactics in the wake of the 9/11 terrorist attacks. More than 1,800 people, including teenagers and many uninvolved bystanders, were caught up in the massive police sweep outside the convention that was held to mark the nomination of George W Bush for a second presidential term.

The deal, announced by the law department of the city of New York on Wednesday, does not come down on either side of the argument. It admits no liability on the part of the NYPD, noting that for nine years City Hall and the police department “had vigorously defended all these lawsuits, maintaining that the conduct of the police had at all times been constitutional”.

It nevertheless involves a payment of $10.4m to individual plaintiffs and to 1,200 members of a class action that alleged violation of their rights, and a further $7.6m in attorneys’ fees, costs and expenses.

The settlement offers a note of agreement between the parties, saying that “both the plaintiffs and defendants recognize the difficulties in policing an event of this magnitude, especially in New York City.” But it adds that the circumstances of the arrests at the RNC had been “heavily disputed” and in the end “the parties and the court believed it was in the best interests of all involved to settle the outstanding claims at this time.”

The events of 30 August to 2 September 2004 in New York were among the most dramatic of any political convention in US presidential history. Tensions were running high over the invasion of Iraq the previous year and hundreds of thousands marched against Bush and the war in one of the largest expressions of public dissent against a president.

Wednesday’s settlement notes that the demonstrators “on the whole, protested lawfully and peacefully”. But a total of 1,806 were arrested, most on charges of parading without a permit or disorderly conduct.

Lawyers acting on behalf of the protesters renamed Pier 57, then a disused former bus depot in Manhattan where those arrested were taken, Guantánamo on the Hudson. “All that was missing were the orange jumpsuits. Under the guise of terrorism and the fear of terrorism, we are all losing our rights,” Jonathan Moore, the lawyer who filed the original lawsuit a few months after the convention, said at the time .

Pier 57 was not properly adapted for use as a detention center. In it, detained individuals were herded 30 or 40 at a time into 10ft by 20ft pens.

Some were held for more than two days without being brought before a judge, a violation of New York’s legal limit of 24 hours between arrest and arraignment. They were only released when a New York supreme court judge ruled the breach of the deadline a contempt of court.

Some released detainees were taken straight to hospital for treatment of rashes and asthma caused by oil-soaked floors and chemical fumes. Most had the charges against them were dropped immediately or within six months of the arrests, and some police claims of resisting arrest were later shown to be spurious through video evidence gathered by defence lawyers.

The announcement of the final settlement only two weeks into the term of New York’s new mayor, Bill de Blasio, may not be entirely coincidental. Former mayor Michael Bloomberg, and his police chief Ray Kelly, had consistently defended the conduct of the NYPD in the week of the RNC convention, 30 August to 2 September 2004, saying it had been justified by intelligence of possible violent threats that had been uncovered. But the documentary evidence to support that claim has never been released.

In the wake of the 9/11 attacks three years previously, Bloomberg and Kelly had expanded the activities of the NYPD dramatically to include surveillance and infiltration of political and protest groups. A year before the convention they received court approval to expand NYPD investigations into the work of political and social organisations, which Kelly said was necessary as “we live in a more dangerous, constantly changing world”.

When the convention came along, with its venue in the overwhelmingly liberal city of New York, tensions were running high particularly over the invasion of Iraq that occurred the previous year. Hundreds of thousands marched against Bush and the war in one of the largest expressions of public dissent against a president.

Before Wednesday’s settlement, the fact of which was first disclosed by the New York Times, the city had already spent more than $18m fighting legal battles in the aftermath of the convention: $2.1m to resolve 112 of the total of 600 individual claims, and a further $16m in legal fees. The final settlement brings the total cost of the police over-reach to $34m.