The city attorney or town attorney may perform the duties of a county attorney. A city or town may perform the duties of a local government only if the city or town adopts a soil loss ordinance and the land specified in the complaint is located within the city or town.