The mayor and council shall appoint a city attorney. The city attorney may be responsible for representing and defending the city in all litigation in which the city is a party; may at the discretion of the mayor and council be the prosecuting officer in the municipal court; shall attend the meetings of the mayor and council as directed; shall advise the council, mayor and other officers and employees of the city, concerning legal aspects of the city's affairs, and shall perform such other duties as provided by the mayor and councilmen.