
646 P.2d 1219 (1982)
Gregory Alan COLLIER, Petitioner,
v.
The Honorable Robert G. LEGAKES, as District Judge, Eighth Judicial District court of the state of Nevada, in and for the County of Clark, Respondent.
The STATE of Nevada, Petitioner,
v.
The Honorable Thomas J. O'DONNELL, District Judge, Eighth Judicial District Court of the State of Nevada, in and for the County of Clark; Bernice Diane Cardarelli; William O'Donnell; and Vicky Ingegneri, Defendants, Respondents.
Russell Wayne CREW, Petitioner,
v.
The Honorable Addeliar D. GUY, Judge of the Eighth Judicial District of the State of Nevada, in and for the County of Clark, Respondent.
Nos. 13900, 13914 and 13928.
Supreme Court of Nevada.
June 25, 1982.
*1220 Richard H. Bryan, Atty. Gen., Carson City, Robert J. Miller, Dist. Atty., James N. Tufteland, Deputy Dist. Atty., Daniel M. Seaton, Chief Deputy Dist. Atty., Morgan D. Harris, Public Defender, Terrence M. Jackson, Deputy Public Defender, Goodman, Terry, Stein & Quintana, Las Vegas, for petitioners.
City, Robert J. Miller, Dist. Atty., James N. Tufteland, Daniel M. Seaton, Chief Deputy Dist. Attys., John J. Momot, David Abbatangelo, Las Vegas, for respondents.

OPINION
PER CURIAM:
In these mandamus proceedings, all petitioners challenge orders of the respondent district court granting or denying pretrial motions to disqualify the Clark County district attorney's office from the prosecution of certain criminal proceedings. We deny the petitions in No. 13900 and No. 13928. We grant the petition in No. 13914.

STATEMENT OF THE FACTS

No. 13900:
Petitioner Collier is charged with murder, robbery with the use of a weapon, and possession of a firearm by an ex-felon. Collier is represented by the Clark County Public Defender's Office. When his case first came to the public defender's office, Thomas Leen was the chief deputy public defender. Thomas Leen now works for the Clark County District Attorney's Office as chief deputy district attorney, but is not participating in Collier's prosecution.
Collier moved the district court to disqualify the district attorney's office from prosecuting his case. The district court conducted an evidentiary hearing and thereafter denied Collier's motion.

No. 13914:
Defendants William O'Donnell, Vicky Ingegneri, and Bernice Cardarelli are charged with selling a controlled substance and conspiracy to sell a controlled substance. Defendant O'Donnell is represented by the Clark County Public Defender's Office and defendants Ingegneri and Cardarelli have each retained private counsel.
Defendant Cardarelli moved the district court to disqualify the Clark County District Attorney's Office from prosecuting the case on the ground that Thomas Leen had formerly represented co-defendant O'Donnell while Leen was employed at the Clark County Public Defender's Office. The district court, without holding an evidentiary hearing, granted Cardarelli's motion, thereby disqualifying the district attorney's office from prosecuting all three defendants.

No. 13928:
Petitioner Russell Crew, charged with two counts of murder and two counts of use of a deadly weapon in the commission of a crime, moved the district court to disqualify the Clark County District Attorney's Office from prosecuting his case. He contended that a conflict of interest was present due to Bill Berrett's position with the district attorney's office as a deputy. Mr. Berrett, a former private practitioner, had represented Crew's co-defendant at the co-defendant's murder trial. Berrett is not participating in Crew's prosecution, however.
After holding a hearing on the motion, and reviewing the briefs and affidavits submitted in support of and in opposition to the motion, the district court denied Crew's motion.

DECISION
The disqualification of a prosecutor's office rests with the sound discretion of the district court. Tomlin v. State, 81 Nev. 620, 407 P.2d 1020 (1965); Hawkins v. 8th District Court, 67 Nev. 248, 216 P.2d 601 (1950); Trone v. Smith, 621 F.2d 994 (9th Cir.1980). In exercising that discretion, the trial judge should consider all the facts and circumstances and determine whether the prosecutorial function could be carried out impartially and without breach of any privileged communication. As stated in State v. Tippecanoe County Court, 432 N.E.2d 1377, 1379 (Ind. 1982):
[E]thical rules require that a lawyer should avoid even the appearance of professional *1221 impropriety and that in certain situations the disqualification of one lawyer within a law firm means that all members of the firm are also disqualified. Canons 5 and 9, DR 5-105(D). While this principle is strictly enforced in the context of civil actions conducted by private law firms, it is less strictly applied to government agencies. Where a lawyer who has represented a criminal defendant on prior occasions is one of the deputy prosecutors, disqualification of the entire office is not necessarily appropriate. Individual rather than vicarious disqualification may be the appropriate action, depending upon the specific facts involved. (Emphasis added).
Further, we recognize that vicarious disqualification may be warranted in extreme cases where the appearance of unfairness or impropriety is so great that the public trust and confidence in our criminal justice system could not be maintained without such action. Such an extreme case might exist even where the state has established an effective screen precluding the individual lawyer's direct or indirect participation in the prosecution.
Finally, while mandamus lies to enforce ministerial acts or duties and to require the exercise of discretion, it will not serve to control the proper exercise of that discretion or to substitute the judgment of this court for that of the lower tribunal. See Kochendorfer v. Board of Co. Comm'rs., 93 Nev. 419, 566 P.2d 1131 (1977).
In petition No. 13900, the district judge, after considering the testimonial evidence presented at the evidentiary hearing, exercised his discretion and denied Collier's motion to disqualify. Similarly, in petition No. 13928, the district judge, after holding a hearing on Crew's motion to disqualify and reviewing the briefs and affidavits submitted in support of and in opposition to the motion, denied Crew's motion. Since the respondent district judges in both petition No. 13900 and petition No. 13928 exercised their discretion, and since neither Collier nor Crew has demonstrated that the district judges acted arbitrarily or capriciously in doing so, mandamus does not lie to challenge the denial of their motions to disqualify. Accordingly, we deny the petitions in No. 13900 and No. 13928.
In petition No. 13914, however, the district judge granted the motion to disqualify without holding an evidentiary hearing. Additionally, the district judge refused to hear argument from the district attorney. His ruling was based solely on the appearance of impropriety, rather than a consideration of all the facts and circumstances. We find, therefore, that the district judge, in effect, failed to exercise his discretion. Accordingly, we grant a petition for writ of mandamus in No. 13914. We vacate the order of the district court disqualifying the entire district attorney's office. The district court shall conduct an evidentiary hearing on defendant Cardarelli's motion, and after a consideration of all the relevant facts, shall determine whether the prosecutorial function can be carried out by the Clark County District Attorney's Office impartially and without breach of any privileged communication.[1]
NOTES
[1]  We express no opinion on what the outcome of that hearing should be.
