The city council shall appoint a city attorney and assistant city attorneys if necessary, who shall serve at the pleasure of the council. 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 council be the prosecuting officer in the municipal court; shall attend the meetings of the council as directed; shall advise the council, city manager, 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 council.