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.

For all that has been spent, some cases still have not been resolved — and some mystery remains about the exact role of undercover police officers in the surveillance of protesters and activists. The former chief of intelligence for the Police Department, David Cohen, has said the infiltration was necessary because of what he called a “commingled” threat during the convention from civil disobedience and terrorism.

The litigation has revealed that undercover officers were present when a giant paper dragon was ignited outside Madison Square Garden as anarchists paraded with it up Seventh Avenue.

One of the officers, testifying anonymously in a deposition, said that he was assigned to “ghost and provide cover” for another undercover officer who was embedded with the anarchists. He testified that the other officer, not identified, was from another jurisdiction, which also was not named.

Shortly before the dragon was ignited, an electronics manufacturing representative named Eric Cashdan said, he and his daughter, Marina, were watching from the sidewalk and standing alongside a senior police officer in a white shirt and another man in a suit.

“They were rubbing elbows with me on my left side,” said Mr. Cashdan, now 67. “One pointed toward the dragon and said, ‘He’s the one who’s going to light it.’ As if they knew in advance that someone was going to set it on fire.”

Moments later, he said, he saw smoke billowing from the dragon and a chaotic scattering of people from the street. He said that he and his daughter walked downtown to get away from the commotion.

Mr. Cashdan described the events in an interview on Tuesday, and also gave a deposition in a lawsuit brought by Yusuke Joshua Banno, a college student from Arizona who was arrested, charged with arson and inciting riot, and held on $200,000 bail. All charges were dropped by the Manhattan district attorney’s office after Mr. Banno’s lawyers produced photographs showing that he was not near the part of the dragon that ignited.

During the civil lawsuit, which is one of a few that has not been resolved in the recent settlement negotiations, Mr. Banno’s lawyers provided the city with a picture of the senior police officer who, Mr. Cashdan said, had predicted the ignition of the dragon.

“The city never responded with the name of that captain or any other information about him,” said Jeffrey Fogel, a lawyer representing Mr. Banno. “It is our firm belief that the out-of-jurisdiction cop participated in torching the green dragon. Josh’s arrest was a cover-up for that.”

The city, which brought in pro bono lawyers from major firms during the litigation, has left that question unresolved. Instead, Mr. Fogel said, it recently offered to settle the case, though the negotiations have lagged.

A new mayoral administration is finding that it is sweeping up the remnants of a big, odorous mess.

A version of this article appears in print on , on Page A17 of the New York edition with the headline: Mass Arrests During ’04 Convention Leave Big Bill and Lingering Mystery. Order Reprints | Today’s Paper | Subscribe