
65 Cal.Rptr.3d 815 (2007)
155 Cal.App.4th 160
The PEOPLE, Plaintiff and Respondent,
v.
Edgardo MUNOZ, Defendant and Appellant.
No. C053570.
Court of Appeal of California, Third District.
September 14, 2007.
*816 Candace Hale, under appointment by the Court of Appeal, Sausalito, for Defendant and Appellant.
Edmund G Brown, Jr., Attorney General, Mary Jo Graves, Chief Assistant Attorney General, Michael P. Farrell, Senior Assistant Attorney General, Michael A. Canzoneri, Supervising Deputy Attorney General, for Plaintiff and Respondent.
CANTIL-SAKAUYE, J.
Defendant Edgardo Munoz pled no contest to attempted murder (Pen.Code, §§ 187, subd. (a), 664)[1] and admitted being personally armed with a firearm during the commission of the offense (§ 12022.5). In exchange for his plea, numerous other counts and enhancements, including two counts for attempted murder and gang allegation enhancements, were dismissed with a waiver pursuant to People v. Harvey (1979) 25 Cal.3d 754, 159 Cal.Rptr. 696, 602 P.2d 396 (Harvey).
Defendant was sentenced to the upper term of nine years for the attempted murder and the upper term of 10 years for the firearm enhancement, for a total state prison term of 19 years. Defendant timely appealed and obtained a certificate of probable cause. (§ 1237.5.) His sole contention on appeal is that his upper-term sentence violated the Sixth Amendment to *817 the United States Constitution. We shall affirm.

BACKGROUND
As defendant entered a no contest plea, the facts underlying the offenses are taken primarily from the probation report.
On June 27, 2005, officers responded to a report of shots fired and robbery in progress. Officers found a car high-centered on a berm. The windshield and rear windows of the car had been broken and glass was scattered throughout the car's interior. The stereo had been torn from its mountings. The driver, John Masters, had a head injury and was bleeding from his left arm.
Masters told officers he had been driving his car when he saw defendant, who was driving defendant's sister's car, make a U-turn and start following him. Masters made numerous unsuccessful attempts to lose defendant. Defendant managed to pull up next to Masters's car and attempted to collide with him. Masters swerved to avoid the collision, skidded, and high-centered his car on the berm. He told his two minor passengers to get out and run.
Defendant and three other individuals approached Masters. Defendant struck Masters several times on the head, back and side with a club, and stabbed Masters in the arm with a knife or screwdriver. During the assault, one of defendant's companions stole the stereo from Masters's car.
Some bystanders yelled at defendant and his companions. One of the companions broke Masters's windshield with a rock and defendant broke another window. They then got in defendant's car and fled. Masters told officers defendant claimed membership in the Norteño criminal street gang. Although Masters's two passengers had called 911 and said they heard gun-shots, officers found no evidence of gunshots. Witnesses saw defendant strike Masters and his car with a pipe.
Defendant claimed he followed Masters's car after Masters made him angry by throwing hand signals and flipping him off. Defendant provided conflicting stories about what happened after Masters's car got stuck on the berm. He said he left at that point. On the other hand, he also said he got out, confronted Masters, and Masters pulled a knife on him. Defendant denied striking Masters with a pipe or pulling out a knife. Later, he said he grabbed a "tool" from the car when he got out to confront Masters and swung it at Masters to protect himself. He also said he did not realize his companion had taken Masters's stereo until he got into the car to leave.
Two months later on August 27, 2005, officers responded to a report of shots fired. Officers found a car flipped over and resting on its roof. Masters and his two minor passengers were being treated by medical personnel.
Masters told officers that defendant had pulled up behind him and started shooting at his car while driving at high speed. Defendant rammed the back of Masters's car causing Masters to lose control, go down the embankment and flip over. Defendant then fled the scene. Witnesses reported hearing gunshots and saw defendant's car leave the scene. Masters admitted that he was a Sureño criminal street gang member when he was younger.
Masters was flown to the hospital via Enloe Flight Care, where he was treated for a fractured arm and multiple bruises to his head and upper torso. His arm will require further surgery to repair the damage. Masters's two minor passengers were also treated at the hospital. One was treated for head and spinal pain, and pain *818 to his finger. The other was treated for a contusion to his head and for spinal pain.
Defendant had a .22-caliber revolver when he was arrested. At the time of his arrest, he told officers he had engaged in a high-speed chase because Masters had flashed gang signs at him and such "disrespect" upset him. During the chase, Masters slammed on his brakes, which caused defendant to slam into the back of Masters's car. Defendant fled the scene because "there were three of them." Defendant admitted being a Norteño criminal street gang member and was"' wearing a red belt and had a red bandana in his pocket.
Defendant, however, later denied gang membership or gang involvement, although he admitted that he and Masters have had ongoing problems since they were young. In his later explanation, he claimed he got angry and chased Masters at high speed after Masters flipped him off. During the chase, he heard gunshots and realized his friend was driving behind them, shooting a gun. Defendant claimed Masters slammed on his brakes, which caused Masters to go off the road and flip over. In another version, defendant claimed that after Masters slammed on his brakes, Masters sped up and came toward defendant. In this version, both cars collided, spun in circles, and Masters's car went off the cliff. Defendant also claimed he was high on crystal methamphetamine at the time of the incident and later arrest.
As to the June 27, 2005 incident, defendant was charged with assault with a deadly weapon (knife and/or pipe) (§ 245, subd. (a)(1)) and felony vandalism (§ 594, subd. (a)). It was also alleged that defendant committed the assault for the benefit.of a street gang (§ 186.22, subd. (b)(1)).
As to the August 27, 2005 incident, defendant was charged with the attempted murder of Masters (§§ 664, 187, subd. (a)) with a special allegation that he personally inflicted great bodily injury during the commission of the offense (§ 12022.7, subd. (a)), and two additional counts of attempted murder with respect to Masters's two passengers. It was alleged that defendant had personally and intentionally discharged a firearm in the commission of the attempted murders (§ 12022.53, subd. (c)) and had committed the attempted murders for the benefit of a street gang (§ 186.22, subd. (b)(1)). Defendant was also charged with shooting at an occupied vehicle (§ 246) and it was alleged he had done so for the benefit of a street gang (§ 186.22, subd. (a)(4)(B)).
Pursuant to a plea agreement, defendant pled no contest to the attempted murder of Masters and admitted he had personally used a firearm in the commission of the offense (§ 12022.5), a lesser gun enhancement than the one charged. In exchange for his plea, all the remaining counts and enhancements were dismissed. Two additional cases, which we describe here for reasons discussed post, were also dismissed as part of the plea agreement: (1) case No. SCR-47661defendant was charged with misdemeanor battery (§ 243, subd. (e)(1)) in connection with a September 2004 incident wherein it was alleged he had head-butted his girlfriend during a domestic dispute and caused a lump on her forehead; and, (2) case No. CM-023703 defendant was charged with making criminal threats (§ 422), assault with a deadly weapon by means likely to produce great bodily injury (§ 245, subd. (a)(1)), and cutting a utility line (§ 591) in connection with a May 2005 incident wherein it was alleged he pulled a knife on his girlfriend, threatened to kill her, attempted to slash her, held her against her will for 15 minutes, and disabled the telephone when she tried to call for help. The plea agreement specifically included a Harvey waiver.
*819 The trial court sentenced defendant to the upper term of nine years for the attempted murder and the upper term of 10 years for the firearm enhancement, for a total state prison term of 19 years. In imposing the upper term, the court found the circumstances in aggravation outweighed those in mitigation. In aggravation, the court considered that the crime involved great violence and great bodily injury, and that defendant has a history of violence and is increasingly dangerous.

DISCUSSION
Defendant contends that imposition of the upper term violated his right to a jury trial and proof beyond a reasonable doubt as interpreted in Apprendi v. New Jersey (2000) 530 U.S. 466, 120 S.Ct. 2348, 147 L.Ed.2d 435 (Apprendi), Blakely v. Washington (2004) 542 U.S. 296, 124 S.Ct. 2531, 159 L.Ed.2d 403 (Blakely), and Cunningham v. California (2007) 549 U.S. ___, 127 S.Ct. 856, 166 L.Ed.2d 856 (Cunningham).
Apprendi held that other than the fact of a prior conviction, any fact that increases the penalty for a crime beyond the statutory maximum must be tried to a jury and proved beyond a reasonable doubt. (Apprendi supra, 530 U.S. at p. 490, 120 S.Ct. at p. 2363, 147 L.Ed.2d at p. 455.) For this purpose, the statutory maximum is the maximum sentence a court could impose based solely on facts reflected by a jury's verdict or admitted by the defendant; thus, when a court's authority to impose an enhanced sentence depends upon additional factfindings, there is a right to a jury trial and proof beyond a reasonable doubt on the additional facts. (Blakely, supra, 542 U.S. at pp. 303-305, 124 S.Ct. at pp. 2537-2538, 159 L.Ed.2d at pp. 413-414.)
In Cunningham, supra, 549 U.S. at p. ___, 127 S.Ct. at p. 860, 166 L.Ed.2d at p. 864, the United States Supreme Court held that by "assigning] to the trial judge, not to the jury, authority to find the facts that expose a defendant to an elevated `upper term' sentence," California's determinate sentencing law "violates a defendant's right to trial by jury safeguarded by the Sixth and Fourteenth Amendments." (Ibid., overruling People v. Black (2005) 35 Cal.4th 1238, 29 Cal.Rptr.3d 740, 113 P.3d 534 on this point, vacated in Black v. California (2007) ___ U.S. ___, 127 S.Ct. 1210, 167 L.Ed.2d 36.)
Of course, as the Supreme Court expressly recognized in Blakely, a defendant entering into a plea agreement may waive his right to a jury trial on additional facts used to impose an enhanced sentence. "When a defendant pleads guilty, the State is free to seek judicial sentence enhancements so long as the defendant either stipulates to the relevant facts or consents to judicial factfinding. [Citations.]" (Blakely, supra, 542 U.S. at p. 310, 124 S.Ct. at p. 2541, 159 L.Ed.2d at pp. 417-418.)
In this case, defendant pled no contest and entered a Harvey waiver. In Harvey, supra, 25 Cal.3d 754, 159 Cal.Rptr. 696, 602 P.2d 396, the Supreme Court held that, in imposing sentence under a plea bargain, the court may not consider evidence of any crime as to which charges were dismissed as a "circumstance in aggravation" supporting the upper term on the remaining counts. (Harvey, supra, at p. 758, 159 Cal.Rptr. 696, 602 P.2d 396.) The court deemed it "improper and unfair" to permit the sentencing court to consider any of the facts underlying dismissed counts because, absent an agreement to the contrary, a plea bargain implicitly includes the understanding that the defendant will suffer no adverse sentencing consequences by reason of the facts underlying, and solely pertaining to, dismissed counts. (Ibid.)
*820 To avoid the Harvey restriction, prosecutors often `condition[ ] their plea bargains upon the defendant agreeing that the sentencing court may consider the facts underlying the not-proved or dismissed counts when sentencing on the remainder." (People v. Myers (1984) 157 Cal.App.3d 1162, 1167, 204 Cal.Rptr. 91.) Defendants may accept this relatively minor potential consequence in order to avoid other convictions or sentencing enhancement terms. (Ibid.) This agreement is known as a "Harvey waiver." (Ibid.) A Harvey waiver permits the sentencing court to consider the facts underlying dismissed counts and enhancements when determining the appropriate disposition for the offense or offenses of which the defendant stands convicted. (People v. Moser (1996) 50 Cal.App.4th 130, 132-133, 57 Cal. Rptr.2d 647.)
In the "SENTENCING" section of the plea form, defendant initialed the following provisions:
"28. I DO UNDERSTAND THAT THE MATTER OF PROBATION AND SENTENCE IS TO BE DETERMINED SOLELY BY THE SUPERIOR COURT JUDGE.
"29. (HARVEY WAIVER) I STIPULATE THE SENTENCING JUDGE MAY CONSIDER MY PRIOR CRIMINAL HISTORY AND THE ENTIRE FACTUAL BACKGROUND OF THE CASE, INCLUDING ANY UNFILED, DISMISSED OR STRICKEN CHARGES OR ALLEGATIONS OR CASES WHEN GRANTING PROBATION, ORDERING RESTITUTION OR IMPOSING SENTENCE."
Both defendant and his trial counsel stated that these terms were read verbatim to defendant and defendant understood them. Pursuant to the agreement, the additional counts, enhancements, and two additional cases were dismissed, with the court specifically noting it was with a Harvey waiver.
The Harvey waiver that defendant entered in this case was explained in extremely broad terms. The waiver encompassed not only the entire factual background of the case, including any unfiled, dismissed or stricken allegations, charges, or cases, but also encompassed defendant's criminal history, which included several additional instances of violence charged in separate cases. (See Harvey, supra, 25 Cal.3d 754, 159 Cal. Rptr. 696, 602 P.2d 396.) Further, defendant specifically understood the judge alone, not a jury, would determine his sentence.
The trial court imposed the upper term because the crime involved great violence and great bodily injury, and because defendant has a history of violence and is increasingly dangerous. (See Cal. Rules of Court, rule 4.421(a)(1) and (b)(1).) Defendant argues that none of these facts were found by a jury to be true beyond a reasonable doubt and, indeed, it is unclear that a jury presented with the question would have found them to be true, because they were based on dismissed and disputed charges. However, all of these aggravating factors cited by the trial court were encompassed in defendant's waiver, which permitted the trial court to consider the entire background of the case, the dismissed or stricken charges or allegations and defendant's criminal history when imposing sentence.
Defendant had engaged in acts of domestic violence, as well as gang-related violence. He admitted to the probation officer that he had head-butted his girlfriend because she wanted to break up with him. Although he denied holding his girlfriend hostage or threatening her with a knife, he admitted something had occurred that evening when he put in his statement in mitigation that his sister had *821 "witnessed the incident" and "told law enforcement that although defendant had a pocketknife in his hand, it wasn't open during the incident."
Despite defendant's eventual claim to the probation officer that he was not involved with a gang, in light of the facts, his attorney understandably admitted that the other instances of violence involved gang activity. Defendant admitted to chasing the victim twice in his car, at least once at high speed, "confronting" the victim the first time when the victim's car was disabled and hitting him with a weapon, and running him off the road the second time. He justified this behavior by explaining he was angry because the victim "threw up hand signals." No one disputed that defendant's actions resulted in great bodily injury.
Thus, throughout the sentencing proceedings, defendant effectively "stipulated to the relevant facts" necessary to impose the upper term, thereby waiving his right to have a jury trial and proof beyond a reasonable doubt on those facts. (Blakely, supra, 542 U.S. at p. 310, 124 S.Ct. at p. 2541, 159 L.Ed.2d at pp. 417-418.) As part of a plea bargain wherein three separate cases involving numerous violent charges and enhancements were dismissed with a Harvey waiver and having specifically agreed that the trial court could consider those facts for purposes of aggravating his sentence, defendant cannot now complain of error under Blakely and Apprendi. (Ibid.)

DISPOSITION
The judgment is affirmed.
We concur: SCOTLAND, P.J., and MORRISON, J.
NOTES
[1]  Hereafter, undesignated statutory references are to the Penal Code.
