In the first Los Angeles County election on April 1, 1850, Hayes, a Democrat, was elected county attorney, "a prosecuting office then provided by law" serving until September 1851.
In July of the same year he was elected the first city attorney in Los Angeles, and he served until May 1851.

In 1852 he was elected first judge of the district court that served Los Angeles, San Diego and San Bernardino counties; he was reelected in 1857.
Hayes "journeyed over his district on horseback and later by carriage and the little steamer, Senator.
Court he convened in whatever available structure there was."

In Los Angeles, in 1859, court was held in a dingy unhealthy old adobe standing at Franklin and Spring streets.
When it rained[,] water came through the roof in streams onto the judge's head, his desk and papers, and spattered against the walls, making an umbrella a necessary adjunct of court attendance.

In 1856, he freed 14 blacks, including Biddy Mason, who were held in captivity by Mormons in San Bernardino.

Hayes held court in both English and Spanish; he recorded in his diary that he was able to read and write Spanish with competence but that he was not fluent in speaking it.
He also found a problem with the lack of lawbooks.

One biographer wrote that Hayes "courageously administered justice in the violent Fifties, when mob rule so frequently took matters under its own control."
While he was county attorney in 1851[,]  a disgruntled litigant on horseback fired at him from three feet away, but the bullet passed harmlessly through Hayes' hat.

In his ten years on the district bench[,] litigation was heavy and important, and as it has transpired, history-making.
Many of Judge Hayes's decisions have took the test of time and are references before the bar today, He is considered by posterity to have been a learned man, with a brilliant legal mind.]
In the first Los Angeles County election on April 1, 1850, Hayes, a Democrat, was elected county attorney, "a prosecuting office then provided by law" serving until September 1851. In July of the same year he was elected the first city attorney in Los Angeles, and he served until May 1851.
In 1852 he was elected first judge of the district court that served Los Angeles, San Diego and San Bernardino counties; he was reelected in 1857. Hayes "journeyed over his district on horseback and later by carriage and the little steamer, Senator. Court he convened in whatever available structure there was."
In Los Angeles, in 1859, court was held in a dingy unhealthy old adobe standing at Franklin and Spring streets. When it rained[,] water came through the roof in streams onto the judge's head, his desk and papers, and spattered against the walls, making an umbrella a necessary adjunct of court attendance.
In 1856, he freed 14 blacks, including Biddy Mason, who were held in captivity by Mormons in San Bernardino.
Hayes held court in both English and Spanish; he recorded in his diary that he was able to read and write Spanish with competence but that he was not fluent in speaking it. He also found a problem with the lack of lawbooks.
One biographer wrote that Hayes "courageously administered justice in the violent Fifties, when mob rule so frequently took matters under its own control." While he was county attorney in 1851[,]  a disgruntled litigant on horseback fired at him from three feet away, but the bullet passed harmlessly through Hayes' hat.
In his ten years on the district bench[,] litigation was heavy and important, and as it has transpired, history-making. Many of Judge Hayes's decisions have took the test of time and are references before the bar today, He is considered by posterity to have been a learned man, with a brilliant legal mind.]
Benjamin Ignatius Hayes