The final costs of settling civil rights lawsuits brought by hundreds of people who were swept up in mass arrests during the 2004 Republican National Convention — many of whom were breaking no laws whatsoever — are likely to be well over $35 million.

That would make the convention lawsuits among the costliest ever defended by New York City.

In a decade of litigation led by the city’s former chief lawyer, Michael A. Cardozo, the Bloomberg administration proved unable to justify the mass arrests made during the last days of August 2004, but was successful in shrouding much of the spying done on political groups by the Police Department’s Intelligence Division.

An agreement, reached by lawyers for the city and those arrested, includes payments on nearly all the outstanding cases of $10,000 to $20,000, plus legal fees, according to four people involved in the negotiations, who insisted on anonymity because they were not supposed to discuss the settlement until it was finalized. While the precise figure will not be announced until next week, those involved said it totaled about $18 million.

That is on top of the money already laid out by the city for the convention lawsuits. By late December, the city had spent $16 million in legal fees defending the cases, and paid another $2.1 million to settle 112 claims.