Though the síndico procurador of the Spanish and Mexican municipality seems to have performed the functions of a county attorney, no constitutional provision was made for a similar official after Texas independence until 1866. Under the constitutions of 1866 and 1869, a county attorney was appointed by the county board for a four-year term. With the adoption of the Constitution of 1876 the office became elective, and the term was changed to two years. A constitutional amendment changed the term back to four years in 1954. The main duties of the county attorney are to represent the state in the justice of the peace and county courts, defend suits in which the county is interested, and serve as legal advisor to county and precinct officials. If the county has no district attorney, the county attorney also represents the state in district courts.