Gloucestershire County Council spent £238,000 defending its plans to hand over libraries to community groups.
The figures obtained by the BBC include both the council's and campaigners' legal costs which the authority had to pay.
The council had wanted to cut its library budget by £2.6m a year, with 10 libraries handed over to the community.
In the end seven libraries were handed over and the mobile service saved, saving the council £1.8m.
Friends of Gloucestershire Libraries (FOGL) had challenged the original proposals in the High Court.
In November 2011, the court ruled the county council's first consultation did not take into account how the closures would affect vulnerable groups.
The Conservative-run council revised its decision and FOGL decided against challenging the new proposals which went ahead at the end of last year.
The legal costs included more than £36,000 spent on council staff time dealing with the case.