Updated

An Arizona sheriff facing huge compliance costs from a court ruling that found his office had racially profiled Latinos has demanded that the federal government fork over nearly $38 million, saying Washington is to blame for providing some of his deputies with faulty immigration enforcement training.

Maricopa County Sheriff Joe Arpaio sent a letter Thursday to U.S. Attorney General Eric Holder and U.S. Immigration and Customs Enforcement demanding that Washington pick up nearly $30 million in compliance costs, $1.2 million in legal fees for defending the sheriff and more than $7 million in legal fees being sought by the lawyers who won the case.

"The federal government's failures (as set forth above) are the direct result of these expenditures," the sheriff wrote.

In late May, U.S. District Judge Murray Snow ruled Arpaio's office systematically singled out Latinos in its regular traffic and immigration patrols and that sheriff's deputies unreasonably prolonged the detentions of people who were pulled over.  Arpaio disputes the finding and has appealed the decision.

The compliance costs include the expense of installing video cameras in hundreds of the agency's patrol vehicles, additional training to ensure officers aren't making unconstitutional arrests and hiring a court-appointed official to monitor the agency's operations.

In the ruling, the judge wrote that Immigration and Customs Enforcement had trained members of Arpaio's immigrant smuggling squad that it was acceptable to consider race as a factor in making law enforcement decisions.

The Justice Department and Immigration and Customs Enforcement declined to comment on the letter.

Cecillia Wang, a lawyer who pressed the profiling case on behalf of a group of Latinos, called the sheriff's letter a publicity stunt that attempts to rewrite history. "It's a complete whitewash for the sheriff to claim that the federal government is the one to blame," Wang said.

Arpaio's office said the federal government backed out of its promise to bear the costs of any litigation stemming from 100 sheriff's deputies who at one time were given the power to make federal immigration arrests. Those deputies were training by Immigration and Customs Enforcement, which in October 2009 rescinded the federal arrest powers for the 100 deputies.

But then the sheriff, who had built much of his national political profile on his immigration enforcement efforts, continued doing immigration enforcement under state immigration laws. Four months after the deputies lost their federal immigration arrest authority, Arpaio held a news conference to announce that his office would train all 881 of its deputies in enforcing immigration law.

The sheriff's office said the case centered on Arpaio's federally trained officers and didn't focus on other sheriff's deputies who didn't have the federal training but were still involved in immigration enforcement.

Wang said Arpaio's federally trained officers were a small piece of the case and that the judge considered the actions of all deputies enforcing immigration law, not just those with federal training.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino