PHOENIX — A federal judge ruled Monday that former Maricopa County Sheriff Joe Arpaio was guilty of criminal contempt of court.

U.S. District Judge Susan Bolton said Arpaio was guilty of misdemeanor contempt after prolonging his controversial immigration sweeps for 17 months after being directed to stop them by a different judge.

Arpaio, 85, was scheduled to be sentenced Oct. 5. He could face up to six months in jail, but most legal experts don’t believe that will be the case.

His attorney said Arpaio will appeal the ruling.

In a statement, the Maricopa County Sheriff’s Office said the ruling “is a conclusion to the disservice and distractions caused by former Sheriff Joe Arpaio. We have a great respect for the justice system and the process and responsibility to carry out justice.”

The lawman had acknowledged extending the patrols, but insisted his disobedience was unintentional. He blamed one of his lawyers for not properly explaining the injunction to him.

Arpaio and three aides had been found in civil contempt for defying U.S. District Judge Murray Snow’s orders in a years-old racial profiling case last year.

The American Civil Liberties Union said Monday’s ruling was a vindication for many.

“Joe Arpaio learned his lesson the hard way — no one, not even America’s so-called toughest sheriff, is above the law,” Deputy Legal Director Cecillia Wang said in a statement.

The decision around Arpaio’s contempt charge was a longtime in the making. The case was delayed several times and the Supreme Court rejected a request to issue a hold. A request for a trial by jury was also denied.

A bid to have U.S. Attorney General Jeff Sessions testify was also rejected.

Prosecutors were against having Sessions testify. They said the subpoena was an attempt to divert attention from key issues in the case.

A judge quashed the subpoena of Sessions because “his testimony is neither relevant nor meets the demanding standard required to compel the testimony of a high-ranking official.”

Arpaio’s two-decadeslong tenure as the head of the sheriff’s office came to an end in November, when he was defeated by Paul Penzone in the general election.

The Associated Press contributed to this report.

Follow @KTAR923