
799 A.2d 470 (2002)
172 N.J. 361
STATE of New Jersey, Plaintiff-Respondent,
v.
Edmond WILLIAMS, Defendant-Appellant.
Supreme Court of New Jersey.
Argued February 26, 2002.
Decided June 19, 2002.
*471 Linda Mehling, Assistant Deputy Public Defender, argued the cause for appellant (Peter A. Garcia, Acting Public Defender, attorney).
Jeanne Screen, Deputy Attorney General, argued the cause for respondent (Peter C. Harvey, Acting Attorney General of New Jersey, attorney).
The opinion of the Court was delivered by LaVECCHIA, J.
This appeal involves the application of our mandatory joinder rule to two prosecutions brought against defendant, Edmond Williams. Defendant sold cocaine to an undercover officer in Atlantic City. Minutes later, as officers approached him, defendant threw away bags of cocaine while attempting to flee. He was indicted for possession of cocaine and resisting arrest. Approximately four months after the indictment issued and two months after defendant pled guilty to those charges, the Atlantic County Prosecutor filed a second indictment against defendant charging him with four drug distribution-related violations based on defendant's initial sale of drugs to the undercover officer. The question presented is whether the mandatory joinder rule should have barred that second prosecution.

I.
On June 10, 1998, Investigator D.W. Fashaw of the Cape May County Prosecutor's office convened nine officers from the Narcotics Section of the Atlantic City Police Department near the 1100 block of Adriatic Avenue of Atlantic City for a surveillance operation. Fashaw, working undercover, was to attempt a drug purchase and the other members of the team were to act as "back-up surveillance officer[s]." Between 6:00 and 6:30 p.m. on that day, Fashaw parked his car in a pre-arranged area near the Shore Terrace, or "Six Bedrooms," housing complex. Within a few minutes, Fashaw engaged defendant in conversation about the purchase of cocaine. At defendant's request, Fashaw followed him to a spot close to the housing complex playground where defendant produced a bag of cocaine. After Fashaw handed defendant a twenty-dollar bill in exchange for the cocaine, defendant rode away on a bicycle he had with him.
Fashaw returned immediately to the location of the surveillance team, turned over the cocaine, and described the details of the transaction to Detective Clayton, another member of the team. Fashaw also identified a photograph of defendant as the person involved in the purchase that *472 had occurred moments earlier. Meanwhile, at about the time the drug sale was taking place, Detective DePaul, a member of the surveillance team, determined "that defendant had to be stopped for identification." Consequently, Sergeant Abrams and Detective Hall of the surveillance team attempted to stop defendant as he bicycled away from the housing complex. When defendant saw the officers approaching, he began to flee.
As defendant rode away, DePaul observed him reach into the right front pocket of his jacket, remove an object, and throw it to the ground. DePaul informed Abrams and Hall of what he had observed and continued the chase along with Officer Dickson, another member of the surveillance team. Meanwhile, Abrams retrieved the thrown item, which turned out to be a zip-lock glassine bag holding four smaller zip-lock bags containing cocaine.
DePaul, Hall, and Dickson continued pursuing defendant. At one point, defendant slowed to a stop when he was cut-off by a police car driven by DePaul. However, when Hall told defendant that he was under arrest, defendant began to flee again. The chase continued until defendant eventually lost control of the bicycle and fell to the ground in the parking lot of the Six Bedrooms complex. Dickson chased defendant down and attempted to place him in handcuffs. A "violent struggle" ensued, but eventually Dickson, DePaul, and the other officers were able to subdue and arrest defendant. A search incident to the arrest recovered twenty-six dollars, including the marked twenty-dollar bill used by Fashaw in the drug purchase.
On July 14, 1998, an Atlantic County indictment was filed (first indictment), charging defendant with third-degree possession of cocaine, contrary to N.J.S.A. 2C:35-10a(1) (count one) and fourth-degree resisting arrest, contrary to N.J.S.A. 2C:29-2a(1) (count two). Defendant filed a motion to suppress the evidence obtained from his arrest; however, he later withdrew that motion and, on September 11, 1998, entered a plea of guilty to count one. On December 4, 1998, in accordance with the plea agreement the trial court sentenced defendant to 180 days of incarceration and two years of probation.
In the meantime, on November 25, 1998 a second indictment was returned by an Atlantic County Grand Jury, charging defendant with third-degree possession of cocaine, contrary to N.J.S.A. 2C:35-10a(1) (count one); third-degree possession of cocaine with intent to distribute, contrary to N.J.S.A. 2C:35-5a(1) and 2C:35-5b(3) (count two); third-degree distribution of cocaine, contrary to N.J.S.A. 2C:35-5a(1) and 2C:35-5b(3) (count three); and second-degree distribution of cocaine within 500 feet of a public housing facility, park or building, contrary to N.J.S.A. 2C:35-7.1 (count four). Defendant moved to dismiss the second indictment claiming that it should have been joined with the first. During the hearing on that motion, the State represented to the court that the prosecutor's office "knew nothing about the undercover case" when it obtained the first indictment against defendant.
The court denied the motion, reasoning that defendant did not satisfy the mandatory joinder requirement that the offenses in both indictments arise from the same episode. The court also noted that the joinder rule "speaks in terms of a trial and the first indictment did not result in a trial," and concluded that there was no prejudice to defendant in having two separate indictments. Defendant entered a plea of guilty to count four of the second indictment, but preserved on the record his right to appeal the denial of his motion to dismiss the indictment. In accordance with his plea agreement, defendant was sentenced to a five-year term of incarceration. *473 He also was awarded thirty-seven days of gap-time credit for time served. Defendant then appealed the denial of his motion to dismiss the second indictment and the calculation of gap-time credit.
The Appellate Division affirmed on both issues. On the joinder issue, the panel held that joinder was unnecessary because the charges in the two indictments were not part of the same episode. The court reasoned that the elements of proof and the relevant witnesses for each of the offenses were separate, that is, the first episode (second indictment) related solely to the drug transaction with the undercover officer, whereas the second episode (first indictment) began when the officers pursued defendant as he attempted escape. Furthermore, the panel held that fundamental fairness did not require joinder of the indictments because defendant reasonably could have expected to be indicted separately for the initial drug sale. The court stated:
There is no indication that the State contemplated an additional prosecution based on the undercover transaction and deliberately withheld its intention. The only reason that the distribution charge was not presented to the first grand jury was that the surveillance operation was ongoing and had to be brought to a conclusion. Defendant's sale to an undercover officer was not the only subject of the surveillance operation.
On the issue of gap time, the panel held that defendant was entitled to gap time only for the thirty-seven days he served in custody on the first sentence.
We granted defendant's petition for certification, 170 N.J. 85, 784 A.2d 718 (2001), and now hold that it was error not to dismiss the second indictment. That ruling makes it unnecessary for us to address the calculation of gap-time credit.

II.
In State v. Gregory, this Court adopted the compulsory joinder rule barring separate trials for multiple offenses that are known to the prosecuting attorney, when the offenses are based essentially on the same conduct or arise from the same criminal episode. 66 N.J. 510, 522, 333 A.2d 257 (1975). Finding support in the common law for the just result it sought to attain, the Court explained that the "common law was properly concerned with the protection of the defendant from governmental harassment and oppression by multiple prosecution for the same wrongful conduct." Id. at 513, 518, 333 A.2d 257. The Court relied on the broad administrative and procedural powers vested in it by the State Constitution. Id. at 518, 333 A.2d 257. The time for adoption of a compulsory joinder rule was "well due," because the rule "will not only tend to satisfy ... considerations of fairness and reasonable expectations ... but will also promote ... considerations of `justice, economy and convenience' ..." Id. at 513, 521-22, 333 A.2d 257 (citations omitted). Although the precise wording of the rule was referred to the Criminal Practice Committee, the Gregory Court adopted for immediate implementation the wording of sections 1.07(2) and 1.07(3) of the Model Panel Code pursuant to which "episode" was defined as "an occurrence or connected series of occurrences and developments which may be viewed as distinctive and apart although part of a larger or more comprehensive series." Id. at 520, 522, 333 A.2d 257 (citations omitted).
In response to Gregory, Rule 3:15-1(b) and N.J.S.A. 2C:1-8b were enacted. The pertinent substantive language of the statute and the court rule governing mandatory joinder are identical. Both provide:
[A] defendant shall not be subject to separate trials for multiple criminal offenses *474 based on the same conduct or arising from the same episode, if such offenses are known to the appropriate prosecuting officer at the time of the commencement of the first trial and are within the jurisdiction and venue of a single court.
[R. 3:15-1(b); N.J.S.A. 2C:1-8b.]
In State v. Yoskowitz, 116 N.J. 679, 701, 563 A.2d 1 (1989), this Court provided additional guidance by summarizing the four factors that a defendant must satisfy in order for multiple offenses to be joined in one prosecution:
(1) the multiple offenses are criminal; (2) the offenses are based on the same conduct or arose out of the same episode; (3) the appropriate prosecuting officer knew of the offenses at the time the first trial commenced; and (4) the offenses were within the jurisdiction and venue of a single court.
If the offenses are not joined, the omitted offense may not be further prosecuted. Gregory, supra, 66 N.J. at 522-23, 333 A.2d 257; Pressler, Current N.J. Court Rules, comment 3 on R. 3:15-1(b) (2002).

III.
There is no dispute that requirements (1) and (4) of the Yoskowitz test are satisfied in this matter. All of the charges involved in both indictments are clearly "crimes" based on the express language of the statutes proscribing such conduct. See N.J.S.A. 2C:35-10a(1), 2C:29-2a(1), 2C:35-5a(1), 2C:35-5b(3), and 2C:35-7.1. Thus, requirement (1) is met. Requirement (4) also is not subject to any serious question because all of the offenses included in the two indictments occurred in Atlantic City and are within the jurisdiction and venue of a single court. Only the remaining two Yoskowitz factors require analysis: whether the offenses involve the "same episode" and whether the appropriate prosecuting officer knew of the offenses at the start of the first trial. Yoskowitz, supra, 116 N.J. at 701, 563 A.2d 1.

A.
The determinative question in this caseas in many cases involving mandatory joinderis the second prong of the Yoskowitz test: whether defendant's criminal activity constituted offenses that were based on the same conduct or arose from the same criminal episode. State v. Pillot, 115 N.J. 558, 567, 560 A.2d 634 (1989); State v. Catanoso, 269 N.J.Super. 246, 273, 635 A.2d 512 (App.Div.1993).
Although neither the statute, nor the rule governing mandatory joinder, expressly define the phrase "same episode," case law supports the conclusion that the offenses in this case arose out of the "same episode." Indeed, our leading case on mandatory joinder, State v. Gregory, involved facts that were strikingly similar to this case.
In Gregory an undercover police officer went to the defendant's apartment and purchased from him an envelope containing a small quantity of heroin. Gregory, supra, 66 N.J. at 511, 333 A.2d 257. The officer saw the defendant go into the bathroom and remove the envelope from a large stack of similar envelopes in the medicine cabinet. Ibid. After the purchase was completed, the officer left the apartment and immediately notified other officers, who returned with him to the apartment and seized the remaining envelopes from the cabinet. Ibid.
Several months later, the defendant was indicted, tried, and convicted for the drug sale only. Id. at 512, 333 A.2d 257. Between the time of the verdict and sentencing on the drug sale conviction, a second indictment charged the defendant with both possession and possession with intent *475 to distribute heroin, which were the charges that related to the seizure of the stack of envelopes from the medicine cabinet immediately after the sale. The defendant was convicted and sentenced on those charges as well. Ibid.
This Court reversed the defendant's second conviction, stating that, "[f]airness dictated that if the State contemplated any additional prosecution based on the ... possession and sale it would join it with the original prosecution rather than withhold mention of it until after trial." Id. at 518, 333 A.2d 257. The Court observed that "[w]hile the sale of the small quantity and the continuing possession of the larger quantity may under our case law be viewed here as separate offenses, surely the occurrences in their entirety ... involved the same conduct or criminal episode for purposes of procedural joinder." Id. at 522, 333 A.2d 257.
Here, as in Gregory, an undercover officer purchased drugs from defendant and then left the scene; the officer immediately notified other officers of the drug sale; shortly thereafter, following a successful police pursuit, the police seized drugs from defendant and placed him under arrest; the drugs sold to an undercover officer were a portion of the drugs seized from defendant just after the sale; defendant was subjected to two separate indictments; and finally the second indictment was returned after a verdict was rendered in the first indictment. The Appellate Division noted two distinctions between Gregory and the present case: the undercover officer in Gregory saw the larger quantity of heroin possessed by the defendant, whereas the undercover officer in this case did not; and in Gregory the undercover officer returned with other officers in order to seize the additional heroin, but in this case the undercover officer was not present at defendant's arrest.
In fact, the undercover officer in this case did participate, indirectly, in defendant's arrest because it was the drug sale that prompted the surveillance officers to stop defendant. Immediately after the undercover purchase, the undercover officer met with surveillance officers, turned over the cocaine he had purchased, and identified defendant's photo, enabling the officers to arrest him. Those differences aside, however, the decision in Gregory did not hinge on the undercover officer's presence during the arrest. Nothing in that opinion suggests that the presence of the undercover officer at the defendant's arrest, or the fact that he saw additional drugs during the undercover purchase, played any significant role in this Court's resolution of that case. The facts in Gregory are substantially like those presented here and support viewing defendant's second indictment as part of the same criminal episode that was involved in his first indictment.
Other cases decided since Gregory have discussed use of a "flexible" approach to determine whether multiple offenses are factually distinct, or are part of the same episode. See Pillot, supra, 115 N.J. at 567, 560 A.2d 634 (citing State v. Best, 70 N.J. 56, 62-63, 356 A.2d 385 (1976); State v. Whipple, 156 N.J.Super. 46, 52, 383 A.2d 445 (App.Div.1978)); see also State v. Currie, 41 N.J. 531, 539, 197 A.2d 678 (1964) (recognizing "the futility of efforts extended towards the formulation of a single legal test to operate absolutely and inflexibly throughout the field of double jeopardy"). Cases applying a "flexible" approach have analyzed many factors, including the nature of the offenses, the time and place of each offense, whether the evidence supporting one charge is necessary and/or sufficient to sustain a conviction under another charge, whether one offense is an integral part of the larger scheme, the *476 intent of the accused, and the consequences of the criminal standards transgressed. Best, supra, 70 N.J. at 63, 356 A.2d 385 (citing State v. Davis, 68 N.J. 69, 81, 342 A.2d 841 (1975)).
Under the "flexible" approach, heightened significance is accorded to the time and place of the offense, and whether one offense is part of a larger scheme. See, e.g., Pillot, supra, 115 N.J. at 567, 560 A.2d 634; Catanoso, supra, 269 N.J.Super. at 273, 635 A.2d 512. Multiple offenses have been found to be part of the "same episode," even when the defendant's actions occurred over several months and at different locations, when the events were connected as part of a larger scheme. State v. James, 194 N.J.Super. 362, 364-365, 476 A.2d 1263 (App.Div.1984) (acknowledging that offenses arose from same episode where defendant fraudulently sold advertising space to different merchants over period of months). When the time between offenses and the location of the offenses becomes too attenuated to constitute one overall scheme, however, courts will find that the events are not part of the "same episode." See, e.g., Catanoso, supra, 269 N.J.Super. at 273-74, 635 A.2d 512 (finding no joinder when defendant over period of years committed separate acts of conspiracy or bribery against different victims in different locations); State v. Colbert, 245 N.J.Super. 53, 59, 583 A.2d 1145 (App.Div.1990) (finding offenses involving illegal handling of hazardous waste over several years was not "same episode" for joinder purposes).
On this record the time between the occurrence of the offenses and the location of the offenses is virtually inconsequential, easily rendering them part of the "same episode." The offenses were committed within six minutes of each other and both occurred within steps of the housing complex. Additionally, a reasonable assessment of defendant's actions indicates that defendant's criminal objective or "overall scheme" was to sell drugs, a scheme he accomplished with the undercover officer, and to avoid arrest for that sale and for possession of the remaining drugs on him when he fled from the approaching police immediately after the sale. His purpose and actions were all part of the same criminal event and should not be subjected to fine sequential parsing that results in an unreasonable second prosecution of defendant.
In sum, the "same episode" requirement of the mandatory joinder rule is met. The case is factually and legally analogous to Gregory and consistent with precedent applying the concept of "same episode." Defendant's offenses were close in time and location and were part of defendant's overall criminal actions relating to his sale of cocaine that day. Holding that defendant's offenses were part of the "same episode" accords with considerations of fairness and defendant's reasonable expectations. See State v. Berry, 41 N.J. 547, 551, 197 A.2d 687 (1964); Currie, supra, 41 N.J. at 539, 197 A.2d 678 (1964).

B.
The prosecutor-knowledge prong of the Yoskowitz test also is satisfied. To meet that prong, the "appropriate prosecuting officer" must know of all the offenses prior to the commencement of the first trial. R. 3:15-1(b); N.J.S.A. 2C:1-8b. In this case there was a plea to the first indictment rather than a trial, but that is not meaningful for purposes of the mandatory joinder rule. See State v. Antieri, 180 N.J.Super. 267, 271, 434 A.2d 668 (Law Div.1981), aff'd, 186 N.J.Super. 20, 451 A.2d 189 (App.Div.), certif. denied, 91 N.J. 546, 453 A.2d 864 (1982) (explaining that commencement, as opposed to completion *477 of trial on first indictment, is sufficient to invoke mandatory joinder rule).
Although the State argued to the courts below that the trial prosecutor was not aware of the sale of drugs when she obtained the first indictment charging defendant with possession of the cocaine he discarded, that argument has been abandoned. At oral argument, the Attorney General, who superseded the County Prosecutor in this appeal pursuant to N.J.S.A. 52:17B-107, properly conceded that knowledge of the undercover case is to be imputed to the trial prosecutor, as a member of the County Prosecutor's Office. See State v. Nelson, 155 N.J. 487, 499-500, 715 A.2d 281 (1998) (imputing knowledge of Brady[1] material received by a county prosecutor's office to trial prosecutor); State v. Russo, 333 N.J.Super. 119, 135, 754 A.2d 623 (App.Div.2000) (citations omitted). As stated in the context of communicating Brady evidence, "[a] prosecutor's office cannot avoid the consequences of its knowledge ... by disclaiming its obligation to inform its lawyers of all relevant matters in [a] case." Nelson, supra, 155 N.J. at 518, 715 A.2d 281 (Handler, J., concurring) (citations omitted).
In conclusion, it is the responsibility of each county prosecutor to direct and supervise the investigations and prosecutions conducted by his or her office in such a way as to avoid interference with a defendant's right to be free of the "harassment" and "oppression" of a second trial on offenses relating to the same episode. See Gregory, supra, 66 N.J. at 518, 333 A.2d 257. Even if the trial prosecutor responsible for the prosecution of defendant's first indictment did not know about the undercover sale, we hold that such knowledge should be imputed to her.
Finally, we note that the State's proffered reason for delaying the second prosecutionthat it did not want to jeopardize the secrecy of the on-going narcotics surveillance operationis substantially outweighed by the need to protect defendant's rights.

IV.
The judgment of the Appellate Division is reversed. The case is remanded to the Law Division for further proceedings consistent with this opinion.
For reversal and remandmentChief Justice PORITZ and Justices STEIN, COLEMAN, LONG, VERNIERO, LaVECCHIA, and ZAZZALI7.
OpposedNone.
NOTES
[1]  Brady v. Maryland, 373 U.S. 83, 87, 83 S.Ct. 1194, 1197, 10 L.Ed.2d 215, 218 (1963).
