A racial profiling case involving former Sheriff Joe Arpaio that has already cost taxpayers in metropolitan Phoenix nearly $66 million over the last nine years is about to get more expensive.

Officials gave preliminary approval Monday to $26 million in additional spending to cover the costs of complying with a court-ordered overhaul of the Maricopa County Sheriff’s Office, which in 2013 was found to have profiled Latinos during the former sheriff’s immigration patrols.

The overhaul was expanded last year when a judge concluded Arpaio had defied an order to stop the patrols. That led the judge to order changes to the agency’s internal affairs investigations, which the judge said had been manipulated to shield sheriff’s officials from accountability over such issues as who was responsible for violating the order.

Over the years, the costs have included $16.7 million in legal fees for lawyers on both sides, paying a team of outsiders $8.9 million to monitor the sheriff’s office on behalf of the judge, conducting officer training to guard against future profiling and setting up an alert system to spot problematic behavior by sheriff’s deputies.

The $26 million in costs in the coming year will center largely on adding officers to work on the effort to comply with the overhaul. The employee costs include regular pay, overtime and retirement benefits. The county also will have to pay outsiders to monitor the sheriff’s office on the court’s behalf, redo internal-affairs investigations that were deemed inadequate and impose discipline on officers for misconduct.

County Supervisor Steve Gallardo, a longtime critic of Arpaio’s immigration enforcement, said the spending should serve as a lesson to people who advocate for local police officers to get into immigration enforcement. “There are unintended consequences, and those unintended consequences are costly,” Gallardo said.

Sheriff Paul Penzone, who unseated Arpaio last year and has vowed to making compliance with the court orders one of his top priorities, said last week that his office has cut costs in the profiling case by getting rid of the outside law firms used by Arpaio and instead using attorneys already employed by the county.

He said he has worked hard since taking office in January to improve his agency’s relations with its adversaries in the profiling lawsuit and with the staff monitoring the sheriff’s office. Arpaio had been criticized for dragging his feet in complying with the orders.

The spending is expected to continue until the sheriff’s office comes in full compliance for three straight years with court-ordered changes.

The sheriff’s office, which was ordered to start making the changes in October 2013, has been deemed 32 percent compliant with the first phase of the overhaul and 48 percent compliant in phase two, according to a report measuring the agency’s progress during the last quarter of 2016.

“It’s not going to happen quickly, but we are looking at every way possible to cut costs and supplement the resources so we can get there more quickly,” Penzone said.

Taxpayers aren’t covering any of Arpaio’s legal costs in defending himself against a criminal contempt-of-court charge for prolonging his patrols. Arpaio, who goes on trial in late June, hasn’t specified how he is paying for those costs, but he has set up a legal defense fund for himself.

The taxpayer spending in the profiling case was believed to have contributed significantly to Arpaio’s defeat in November.

In addition to the costs of the profiling case, the county has had to pay an additional $82 million in legal costs during Arpaio’s 24-year tenure as sheriff. That figure includes judgments, settlements and legal fees involving things such as lawsuits over jail deaths and the lawman’s failed investigations of political enemies.

County officials are scheduled to make a final vote on the funding in the profiling case on June 19.