The mayor with the approval of the council may appoint a city attorney, together with such assistant city attorneys as may be authorized by ordinance. The city attorney shall be responsible for representing and defending the city in all litigation in which the city is a part; shall be the prosecuting officer in the mayor's or recorder's court; shall attend the meetings of the 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 approve as to form and legality all contracts, deeds, ordinances, resolutions, and motions, prescribed by the council or mayor.