PHOENIX — The man who calls himself “America’s toughest sheriff” made his way into the federal district courtroom here on Tuesday wearing a black suit and a stern expression. He spelled out his name for the clerk — “Joseph M. Arpaio, A-R-P-A-I-O,” then raised his right hand, swearing to tell the truth before he took the stand.

“We do not arrest people because of the color of their skin,” Mr. Arpaio, the Maricopa County sheriff, said in court.

Mr. Arpaio, 80, has enjoyed unparalleled popularity during his 20 years as the elected sheriff. Known as Sheriff Joe, he is running for a sixth term while facing his biggest challenges yet: a lawsuit by the Justice Department, and the federal civil rights trial under way here. Both accuse the sheriff and his office of a pattern of discriminatory policing during large-scale operations known as suppression patrols that singled out Latinos — including citizens and legal immigrants — for stops, questioning and detention.

This federal trial resulted from a class-action lawsuit by plaintiffs representing every Latino pulled over by Mr. Arpaio’s deputies since 2007.