
432 N.E.2d 1377 (1982)
STATE of Indiana On the Relation of John H. Meyers, Prosecuting Attorney for the 23RD Judicial Circuit. State of Indiana
v.
The TIPPECANOE COUNTY COURT and the Honorable David Redman As Special Judge Thereof.
No. 981S230.
Supreme Court of Indiana.
April 2, 1982.
*1378 William E. Emerick, Chief Deputy Pros. Atty., for relator.
PER CURIAM.
This is an original action brought by relator following our denial of a temporary writ of mandate and prohibition on August 19, 1981. The issue raised by relator is whether the entire office of the prosecuting attorney in one county should be disqualified because the elected prosecuting attorney was previously a defense attorney for the accused in two prior cases.
The record in this case shows that defendant, Kenneth Paul Smith, was charged with theft and with being an habitual offender in the Tippecanoe County Court on February 19, 1981. The court found that the prosecuting attorney, John H. Meyers, had previously been employed as a public defender and had represented defendant on an appeal from a second-degree burglary conviction in 1974, and on a charge of theft in 1977. This latter charge resulted in a plea agreement with a sentence of one year in the Indiana Reformatory. The court then found that the prosecutor was disqualified because of his previous representation of the defendant and that his entire staff was therefore disqualified. The court appointed a special prosecutor for defendant's case. The prosecuting attorney filed a petition for writ of mandamus with this Court mandating the trial court to withdraw its order disqualifying the elected prosecutor and appointing the special prosecutor. We now grant the petition of the Indiana Prosecuting Attorneys Association to appear and file brief amicus curiae and have considered their excellent brief in our determination of this case. We hereby set out our reasons why this Court voted to deny the writ.
The precise issue raised here has not been previously decided in this state and deserves a careful two-step analysis. First, we must decide whether the prosecuting attorney was properly disqualified under the facts of this case. It is axiomatic that the conduct of all attorneys in this state, whether employed in the public or private sector, is governed by the Code of Professional Responsibility. The precepts of professional ethics forbid the participation of a lawyer in the prosecution of a criminal case if by reason of his professional relation with the accused, he has acquired a knowledge of facts upon which the prosecution is predicated or which are closely interwoven therewith. Canons 4, 5, and 6, Indiana Code of Professional Responsibility. Walker v. State, (1980) Ind. App., 401 N.E.2d 795; Branan v. State, (1974) 161 Ind. App. 443, 316 N.E.2d 406; Wilson v. State, (1861) 16 Ind. 392.
The test, stated alternatively in many jurisdictions, is that a lawyer must be disqualified if it is shown that the controversy involved in the pending case is substantially related to a matter in which the lawyer previously represented another client. Osborn v. District Court, (1980) Colo., 619 P.2d 41; State v. Jones, (1980) 180 Conn. 443, 429 A.2d 936; Schloetter v. Railoc of Indiana, Inc., (7th Cir.1976) 546 F.2d 706. This test must be applied to the facts of each case to determine whether the issues in the prior and present cases are essentially the same or are closely interwoven therewith.
*1379 In this case, it appears that nothing in Meyers's representation of the accused in the two prior theft cases would have any relation to the present theft case. However, the habitual offender charge is based upon the same two prior theft cases in which Meyers was involved. Therefore, there is a substantial relationship involved. Although it is true, that the fact of the defendant's prior convictions are a matter of public record, we cannot say without speculation that the prosecutor's knowledge of those prior cases will not actually result in prejudice to defendant. The public trust in the integrity of the judicial process requires us to resolve any serious doubt in favor of disqualification. The trial court properly held that prosecutor Meyers must be disqualified in this case.
We next turn to the disqualification of the entire staff of deputies. Our ethical rules require that a lawyer should avoid even the appearance of professional 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. Pisa v. Commonwealth, (1979) 378 Mass. 724, 393 N.E.2d 386; Annot. 31 A.L.R.3d 953 (1970).
This Court has set forth the reasons for distinguishing between the public and private sectors in a recent case dealing with a situation in which a deputy prosecutor became a witness. We said in State ex rel. Goldsmith v. Superior Court of Hancock County, (1979) Ind., 386 N.E.2d 942:
"The relationship between the prosecuting attorney and his sole client, the citizens of the circuit in which he serves, is fundamentally and decisively different from a lawyer and the ordinary attorney-client relationship. The lawyers in a law firm have a common financial interest in the case whereas the deputies in a prosecutor's office have an independent duty by law to represent the State of Indiana in criminal matters. Their relationship to each other, rather than pecuniary, is no more than sharing the same statutory duties; and the interest of one deputy which requires him to testify will ordinarily have no financial or personal impact on the other deputies in the office. Thus, there is no reason to recuse the entire staff of deputies of the prosecuting attorney when one deputy becomes a witness in a case handled by the office." 386 N.E.2d at 945 (citation omitted).
Accordingly, we held that when a deputy prosecuting attorney becomes a witness in a case which is being prosecuted by him or another person in the prosecutor's office, the Code of Professional Responsibility does not require a recusation of the entire staff of the prosecutor.
However, we pointed out in that case that the prosecuting attorney exercises authority over and speaks through his deputies. State ex rel. Latham v. Spencer Circuit Court, (1963) 244 Ind. 552, 194 N.E.2d 606.
"Thus, if the elected prosecutor himself becomes a witness in a case or otherwise is disqualified by reason of having an interest in the outcome, his entire staff of deputies must be recused in order to maintain the integrity of the process of criminal justice." State ex rel. Goldsmith, supra, at 945.
Similarly, in this case, the prosecutor who had the administrative control over the entire staff was the one who had formerly represented the particular defendant involved and, therefore, the trial court properly disqualified the entire staff of deputies.
The permanent writ is denied.
