(a) appoint some attorney at law having an office in or residing in the county, or any adjoining county, to act as special district attorney during the absence, inability or disqualification of the district attorney and such assistants as he or she may have; or
(b) appoint a district attorney of any other county within the judicial department or of any county adjoining the county wherein the action is triable to act as special district attorney, provided such district attorney agrees to accept appointment by such criminal court during such absence, inability or disqualification of the district attorney and such assistants as he or she may have. 2. If, for any reason, the appointment of a special district attorney cannot be effectuated pursuant to paragraph (a) or (b) of subdivision one of this section, the court shall then attempt to effect such appointment pursuant to the other such paragraph. 3. Where a special district attorney appointed under this section is a district attorney, he or she may direct the exercise of such powers and the performance of such duties by any assistant in his or her office in any case in which he or she serves as special district attorney to the same extent permitted by law in any case in which he or she serves as district attorney. 4. No appointment made under this section shall be for a period beyond the adjournment of the term at which made. Where, however, an appointment is required under this section for a particular case because of the disqualification of the district attorney, the appointment may be made for all purposes, including disposition. The special district attorney so appointed shall possess the powers and discharge the duties of the district attorney during the period for which he or she shall be appointed. The provisions of this section shall also apply to a county wholly contained within a city. 5. Where a special district attorney is appointed under this section, the board of supervisors of the county wherein such special district attorney serves, after having been notified and provided with an opportunity to be heard, shall pay the necessary disbursements of, and a reasonable compensation for, the services of the person so appointed and acting, as certified by the presiding judge or justice. Nothing contained herein shall prevent any county from entering into an agreement with any other county for the compensation of a special district attorney appointed pursuant to paragraph (b) of subdivision one of this section. In no event shall the compensation paid pursuant to paragraph (b) of subdivision one of this section exceed the compensation paid by the county in which such district attorney, or his or her assistants, serves.