When Denver shelled out $275,000 to settle claims that a mayoral aid harassed a member of his security detail, the bill was actually a lot higher.

The city spent an additional $182,000 on legal fees paid to three private lawfirms. And that’s part of a common pattern, according to documents obtained by a group of news organizations.

Denver paid two outside law firms nearly $245,000 in legal fees by the time it finally reached a settlement with Stuart Shaprio, a former assistant city attorney who was investigated and cleared misconduct in a jail abuse case.

Shaprio won $660,000 in the settlement.

Attorney fees paid to private law firms are the often-hidden cost when a public entity settles a lawsuit. The high-profile payouts make the headlines, but what a city, county or state spent to reach that deal gets lost – even when the total spent on legal fees rivals the settlement itself.

Between 2012 and 2016 Denver paid eight outside law firms about $430,000 dollars to settle lawsuits brought by four people, according to a joint records request made by 9NEWS and KMGH, KDVR, KNUS 710 AM and The Denver Post.

That includes $65,000 to defend Denver after the city was accused of mishandling a public records request.

Denver isn’t the only major city to spend hundreds of thousands of dollars on legal fees. A 2017 review of 20 major cities by Governing revealed that cities like Austin, Phoenix and Seattle spent more on litigation than they did on payouts.

City attorney Kristin Bronson said in a statement that Denver hires a private law firm when the city needs an expert in a particular subject, to avoid legal or ethical conflict or when the office can't handle the workload.

"The CAO works to preserve the taxpayer’s dollars in every case, and decisions to employ outside counsel are not made lightly," Bronson said. "These difficult decisions are made on a case-by-case basis, as there are many factors to be considered."

It’s not just the payments to the lawyers Denver hires that get overlooked when a settlement makes headlines.

Former mayoral aide Wayne McDonald got $200,0000. Lesley Branch-Wise, the woman who accused McDonald of harassment, got $75,000.

What's often overlooked is the amount their attorneys take home.

Branch-Wise kept $47,472.40 of her settlement, and McDonald kept $100,000 from his deal.

That means the private attorneys in these two cases made $309,833.42 while the plaintiffs made less than half of that.