(a) The city attorney shall be legal advisor and counsel for the city and for all the officers and departments thereof in all matters relating to their official duties and shall file with the city a copy of all written opinions given by him. He shall prepare or review all ordinances, regulations, contracts, bonds, and other such instruments as may be required by this Charter, the council, or the city manager, and shall promptly give his opinion as to the legality thereof.
(b) He shall prosecute ordinance violations and shall represent the city in cases before the courts and other tribunals. In such instances as the council shall direct, he shall defend officers and employees of the city in actions arising out of the performance of their official duties.
(c) Upon the city attorney's recommendation, or upon its own initiative, the council may retain special legal counsel to handle any matters in which the city has an interest, or to assist the city attorney.
(d) He shall perform such other duties in connection with his office as may be prescribed for him by this Charter, the council or the city manager.