Updated

The longtime sheriff of metropolitan Phoenix was charged Tuesday with criminal contempt-of-court for ignoring a judge's order in a racial-profiling case, leaving the 84-year-old lawman in a tough spot two weeks before Election Day as he seeks a seventh term.

Prosecutors promised two weeks ago that they would charge Sheriff Joe Arpaio, but the misdemeanor count wasn't officially filed against him until U.S. District Judge Susan Bolton signed it.

Arpaio could face up to six months in jail if convicted. A misdemeanor conviction would not bar Arpaio from serving as sheriff.

Democratic challenger Paul Penzone said Arpaio, through his acts of political defiance, has no one to blame but himself for the charge.

"It's another example of the sheriff putting his own personal objectives ahead of the best interest of the community at our expense," Penzone said.

Arpaio lawyer Mel McDonald said the sheriff will contest the charge. "We believe that when the final chapter is written, he will be vindicated," McDonald said.

McDonald said Arpaio will not be arrested and no mugshot will be taken. He will plead not guilty in a court filing.

The criminal charges stem from the profiling case that Arpaio lost three years ago that morphed into a contempt case after the sheriff was accused of defying a 2011 court order to stop his signature immigration patrols.

Arpaio has acknowledged violating U.S. District Judge Murray Snow's order but insists his disobedience was not intentional.

Snow disagreed, concluding Arpaio knowingly continued the patrols because he believed his immigration enforcement efforts would help his 2012 re-election campaign.

Arpaio ran a TV political ad last week saying the Obama administration's Justice Department planned to prosecute him because of its opposition to his immigration enforcement efforts.

In the past, Arpaio has walked away from criminal investigations without facing charges and still has managed to get re-elected.

He faced a federal investigation four years ago on allegations that he retaliated against two local officials and a judge at odds with him by accusing them of corruption.

His office also was investigated for misspending more than $100 million in jail funds, including on those failed investigations into rival officials and his traffic patrols targeting immigrants who are in the country illegally.

Neither investigation led to prosecution of the sheriff or his employees.

County taxpayers have spent $48 million so far to defend Arpaio and his office in the profiling case. The cost is expected to reach $72 million by next summer.

The contempt violation led the judge to order the creation of a taxpayer-funded system for compensating Latinos who were illegally detained when Arpaio ignored the order.

Maricopa County officials have set aside $1 million for funding the system.

A Dec. 6 trial has been scheduled in Arpaio's criminal contempt case.