Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

PHOENIX — The longtime and controversial sheriff of metropolitan Phoenix was formally charged Tuesday with criminal contempt-of-court for ignoring a judge's order in a racial-profiling case.

Prosecutors promised two weeks ago that they would prosecute Sheriff Joe Arpaio.

Maricopa County Sheriff Joe Arpaio announces newly launched program aimed at providing security around schools in Anthem, Arizona, U.S. January 9, 2013. REUTERS/Laura Segall/File photo LAURA SEGALL / Reuters

But the misdemeanor count wasn't officially filed against the 84-year-old lawman until U.S. District Judge Susan Bolton signed it.

The Morning Rundown Get a head start on the morning's top stories. This site is protected by recaptcha

Arpaio, who is up for re-election Nov. 8 seeking his seventh term, could face up to six months in jail if convicted. A misdemeanor conviction would not bar Arpaio from serving as sheriff.

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.

Related: Arizona: Group Urges Get Out the Vote Effort Against Sheriff Arpaio

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.

The sheriff's office deferred comment to Arpaio lawyer Mel McDonald, who did not immediately return requests for comment.

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.

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.