(CNN) -- Sheriff Joe Arpaio's apparent use of racial and ethnic profiling will cost Maricopa County, Arizona, at least $22 million, according to the county.
A court ruled in May that Arpaio's routine handling of people of Latino descent was not tough enforcement of immigration laws, but instead amounted to racial and ethnic profiling.
The sheriff's office had a history of targeting vehicles with occupants with darker skin or Latino heritage, scrutinizing them more strictly and detaining them more often, U.S. District Judge Murray Snow ruled.
The sheriff's lawyers dispute the judge's conclusion and Arpaio is appealing the decision.
Meanwhile, the judge ordered a monitor to oversee retraining in the sheriff's office and the creation of a community advisory board.
Over the next 1½ years, the county will have to pay $21,943,107 for the monitor and the retraining, according to county budget records. Each year after that it will cost $10 million to keep it going, according to Maricopa County spokeswoman Cari Gerchick.
The money will come from the county's general fund, Gerchick said, and it's not clear if cuts are needed in other areas to find the money.
Maricopa County, which includes Phoenix, has a total budget of $2.2 billion.
CNN's Mayra Cuevas and Ben Brumfield contributed to this report