BROWNSVILLE, Texas (AP) — A former South Texas judge who turned his courtroom into a money-making operation has been sentenced to six years in prison.

U.S. District Judge Andrew Hanen on Wednesday sentenced former state district Judge Abel Limas on one count of racketeering in Brownsville, on the Mexico border.

Limas attracted the FBI's attention in late 2007 as he neared the end of his second term in office. Investigators collected some 40,000 phone calls, as well as surveillance photos documenting how Limas had converted his courtroom into a criminal enterprise, collecting bribes and kickbacks totaling $257,000.

Limas pleaded guilty in 2011 and became the government's star witness in four related trials that shook Cameron County's justice system. He could have faced up to 20 years in prison but received credit for cooperation.