Affirmed in part and dismissed in part by published opinion. Judge MOTZ wrote the opinion, in which Judge TRAXLER and Judge SHEDD joined.
OPINION
Pursuant to a plea agreement, Tyronski Johnson pled guilty to possession of a firearm by a convicted felon and operation of a motor vehicle while under the influence of drugs. Although the agreement contained a standard appeal waiver provision, Johnson retained the right to appeal the denial of his suppression motions, which he does now. He also seeks to have his sentence vacated. We affirm in part and dismiss in part.
I.
A..
On July 22, 2003, at approximately 11 a.m., United States Park Police Officer Ken Bentivegna heard a radio report of a crash on the Baltimore-Washington Parkway. He arrived at the accident scene to find a Toyota with substantial front-end damage stopped in the far right traffic lane of a three-lane segment of the parkway. The car’s badly crumpled hood obscured visibility through the front-windshield. A second car sat on the right shoulder some distance ahead of the Toyota. Officer Bentivegna neither witnessed the accident nor was told how it occurred.
The officer approached the Toyota and saw Tyronski Johnson seated in the driver’s seat, although he did not know Johnson’s name at the time.' A deputy sheriff at the scene told Officer Bentivegna that the driver was conscious but unresponsive. The officer walked to the driver’s side door, which was open, and asked Johnson “if’he was okay, if he had been injured, if anything hurt.” Johnson stared straight ahead and did not respond. Officer Bentivegna continued to ask Johnson if he was alright; obtaining no response, the officer called for an ambulance.
While the officer waited for the ambulance, he asked Johnson if he was okay “[a] couple more times.” The officer testified that he then walked around the car to the front passenger compartment to see if he could “see anything else in the car that might give [him] some kind of an idea as to what was wrong” with Johnson. He wanted to determine whether Johnson had been injured in the accident, was intoxicated, or was suffering from an unrelated medical condition. As Officer Bentivegna walked around the car, Johnson said his chest hurt. The officer asked Johnson whether he hit - the steering wheel and what had happened, but Johnson responded only that his chest hurt.
Officer Bentivegna opened the passenger door and noticed a prescription bottle in the center console of the car. He cursorily looked around the passenger compartment, of the car for any more prescription bottles or narcotics — “anything that might give me an indication as to what happened to this individual.”
■ Officer Bentivegna thought he might get a response from the defendant if he could *142 call him by name, so the officer opened the glove compartment to find identification. Inside, he found a nine millimeter handgun. The officer confiscated the weapon and, with the help of a Prince George’s County deputy sheriff, removed Johnson from the car and placed him in handcuffs for possessing a gun on federal property. Other park police took custody of Johnson while Officer Bentivegna moved Johnson’s vehicle out of the traffic lane, where it had blocked traffic, to the shoulder; the car was too damaged to be driven from the scene arid was eventually towed.
Because Johnson was conscious but unresponsive, Park Police Officer Robert Stratton tried to administer a field sobriety test to him. When Johnson refused to cooperate, Officer Raymon Valencia took Johnson to the hospital to have his blood drawn to test for illegal substances. As Johnson sat handcuffed in the reception area of the emergency room with Officers Valencia and Bentivegna, Johnson stated repeatedly, without prompting, “[Ijt’s only for my protection.” He also stated: “You know, there’s crazy people out there. That’s why I carry a gun.. It’s for protection. I’m not a violent dude. Can I get my baby back? And I just beat a charge. Now. I got a gun charge with the Feds.” Officer Bentivegna obtained a sheet of paper from a nurse and wrote down these statements.
Officer Valencia asked Johnson whether he had been drinking or takeri any drugs, to which Johnson responded that he had smoked a “dipper.” As the district court noted, a “dipper” is a cigarette dipped in liquid phencyclidine or POP. When Johnson asked if his gun could be returned, Officer Valencia asked whether he had registration for the gun, and Johnson said he did not and only carried it for protection.
Johnson’s blood was drawn at the hospital. Pursuant to a contract between the U.S. Park Police and the Army’s Armed Forces Institute of Pathology, the toxicology analysis of Johnson’s blood was performed at the Institute. Johnson’s blood tested positive for POP and a derivative of marijuana.
B.
Johnson sought to suppress the fruits of the search of his glove compartment, the statements he made to the police at the hospital, and the results of the blood test. He filed three motions to suppress. In the first, Johnson argued that the Park Police violated the Fourth Amendment by conducting a warrantless search of his glove compartment; in the second, he maintained that the officers questioned him at the hospital without reading him his rights under
Miranda v. Arizona,
The district court conducted an evidentiary hearing at which Johnson conceded that the unsolicited statements he made at the hospital regarding the gun were admissible, and the Government conceded that Johnson’s “statement that he had smoked a ‘dipper’ must be suppressed because it was the result of custodial interrogation by Officer Valencia without advisement of Miranda rights.” The court therefore granted his second suppression motion in part; the court denied Johnson’s first and third motions in their entirety. See United States v. Johnson, No. CR-03-0364 (D.Md. Dec. 16, 2003).
*143 Johnson then entered into a plea agreement with the Government. In exchange for Johnson’s conditional guilty plea to Count 1, possession of a firearm by a convicted felon in violation of 18 U.S.C. § 922(g)(1), and Count 3, operating a motor vehicle while under the influence of drugs in violation of 36 C.F.R. § 4.23(a)(1), the Government agreed to dismiss Count 2, possession of marijuana in violation of 21 U.S.C. § 844, and to recommend that the court order Johnson’s sentence for Count 3 to run concurrently with his sentence for Count 1. Johnson signed a standard waiver of appellate rights but expressly retained the right to appeal the district court’s denial of his suppression motions. Consistent with the then mandatory United States Sentencing Guidelines, the district court sentenced Johnson to forty months imprisonment .on Count 1 and six months imprisonment on Count 3 to run concurrently with the sentence on Count 1.
Johnson appeals the district court’s denial of his first and third motions to suppress. He also seeks to challenge his sentence as contrary to
United States v. Booker,
— U.S. —,
II.
First, Johnson contends that the district court erred in upholding the search of the glove compartment of his car.
A.
The Supreme Court has recognized that “[t]he Fourth Amendment demonstrates a ‘strong preference for searches conducted pursuant to a warrant.’ ”
Ornelas v. United States,
Searches of cars are one class of situations to which the warrant requirement does not apply.
Maryland v. Dyson,
But the Court has recognized a narrow exception to the warrant requirement that permits a search even if the police lack probable cause to suspect criminal activity. Indeed, the exception only applies when the police are
not
engaged in a criminal investigation, that is, it only applies when they are “engage[d] in what, for want of a better term,' may be de
*144
scribed as community caretaking functions, totally divorced from the detection, investigation, or acquisition of evidence relating to the violation of a criminal statute.”
Dombrowski,
In
Dombrowski,
for example, the Supreme Court concluded that the officer did not act unreasonably when, absent a warrant or probable cause “to believe that the vehicle contained fruits of a crime,”
Opperman,
We agree with the Government that Officer Bentivegna was similarly “reacting to the effect of an accident” and performing a community-caretaking function when he opened Johnson’s glove compartment. Officer Bentivegna arrived at the accident scene to find Johnson sitting unresponsively in his car, which was blocking one of only three traffic lanes on a major thoroughfare. As the Supreme Court has noted, “[t]o permit the uninterrupted flow of traffic and in some circumstances to preserve evidence, disabled or damaged vehicles will often be removed from the highways or streets at the behest of police engaged solely in caretaking and traffic-control activities.”
Opperman,
B.
Nevertheless, Johnson argues that the exception should not apply to Officer Bentivegna’s search because the officer’s stated reasons for opening Johnson’s passenger-side door and the glove compartment are mere pretext for what was really a criminal investigation.
If Officer Bentivegna’s stated reasons for the search were pretextual, the community-earetaking exception would not apply. The exception applies only to conduct that is “totally divorced from the detection, investigation, or acquisition of evidence relating to the violation of a criminal statute,”
Dombrowski,
.Although the district court made no finding that Officer Bentivegna’s stated reasons for the glove compartment search were pretextual, Johnson points to two facts from which, he contends, we must infer that the officer’s true intent was to search for proof of criminal wrongdoing. The first is that Officer Bentivegna opened the glove compartment rather than examining the prescription bottle in plain view, which contained Johnson’s name and suggested a possible medical explanation for his condition. The second is that the officer removed Johnson from his car and handcuffed him without waiting for the ambulance to arrive, which allegedly demonstrates that the officer had no concern for Johnson’s medical condition. We do not believe either fact supports a reasonable inference that Officer Bentivegna used Johnson’s impaired condition and the need to move his disabled vehicle as a pretext for a- search for evidence of a crime.
First, while it is true that the officer could have learned Johnson’s name and medical condition by examining the prescription bottle, looking in the glove compartment for identification was an equally plausible — and possibly more reliable— method of learning Johnson’s name. The fact that Officer Bentivegna did not choose the least intrusive means of obtaining Johnson’s name does not mean that learning Johnson’s identity was not the officer’s true intention.
We continue to adhere to our view that a “warrantless entry for emergency reasons ... cannot be used as the occasion for a general voyage of discovery unrelated to the purpose of the entry.”
United States v. Moss,
Of course, a search that is far more intrusive than necessary to accomplish its purpose may raise questions as to whether the proffered explanation for the search is the true one. ' For éxample, in
Moss
we explained that the officer’s general rummaging through the defendant’s personal effects
after
learning the defem dant’s name “belie[d]” the officer’s claim that he had conducted the search to learn the defendant’s identity so that he could look for him in a forest preserve to make sure he was neither lost nor injured.
Moss,
Similarly, we reject , Johnson’s claim that by arresting him before the paramedics had examinee! him, Officer Bentivegna showed that he had never been concerned about Johnson’s medical condition. When Officer Bentivegna found the gun in Johnson’s glove compartment, his role changed from community caretaker to investigator of illegal activity. That Officer Bentivegna’s role changed does not mean he was never truly engaged in “community caretaking functions, totally divorced from the detection, investigation, or acquisition of evidence relating to the violation of a criminal statute.”
Dombrowski,
Therefore, we affirm the district court’s denial of Johnson’s motion to suppress the fruits of the search of his glove compartment, but we do so on the basis of the community-caretaking exception and not on the basis of the variant of the automobile exception fashioned by the district court.
III.
Johnson next argues that the district court should have excluded his blood test results’ to remedy an asserted violation of the Posse Comitatus Act.
A.
The Posse Comitatus Act states in full: Whoever, except in cases and under circumstances expressly authorized by the Constitution or Act of Congress, willfully uses any part of the Army or Air Force as a posse comitatus or otherwise to execute the laws shall be fined under this title or imprisoned not more than two years, or both.
18 U.S.C. § 1385 (2000).
“The purpose of th[e] Act is to uphold the American tradition of restricting military intrusions into civilian affairs,
*147
except where Congress has recognized a special need for military assistance in law enforcement.”
United States v. Al-Talib,
The Government argues that the Military Support for Civilian Law Enforcement Agencies Act, codified at 10 U.S.C. § 371 et seq., authorizes the contract at issue here. Concerned that “[t]he Posse Comitatus Act, 18 U.S.C. 1385, is sufficiently ambiguous to cause some commanders to deny aid, even when such assistance would in fact be legally proper,” Congress enacted the Act in 1981 to outline the types of aid the military can provide to civilian law enforcement agencies without running afoul of the Posse Comitatus Act. H.R.Rep. No. 97-71, pt. 2, at 3 (1981), reprinted in 1981 U.S.C.C.A.N. 1785, 1785. The legislation attempted to “maximize the degree of cooperation between the military and civilian law enforcement” in dealing with drug trafficking and smuggling while “maintain [ing] the traditional balance of authority between civilians and the military.” Id. The Act permits the Secretary of Defense to “make available any equipment ..., base facility, or research facility of the Department or Defense to any Federal, State, or local civilian law enforcement official for law enforcement purposes.” 10 U.S.C. § 372(a). Thus, Congress clearly has authorized the use of the equipment and facilities of the Armed Forces Institute of Pathology to perform blood tests for civilian law enforcement agencies like the U.S. Park Police.
But this does not mean that § 372(a) authorizes military personnel to perform “searches” of blood in furtherance of misdemeanor DUI prosecutions. Generally, Congress has placed strict limitations on the use of military equipment by military personnel for civilian law enforcement purposes. Military personnel may provide certain expert advice, equipment maintenance, and training to civilian law enforcement officers, see 10 U.S.C. §§ 373, 374(a), but the blood tests at issue in this case concededly do not constitute the provision of expert advice or equipment maintenance.
Nor, notwithstanding the Government’s contrary arguments, do we believe that the performance of ordinary DUI blood tests by military personnel for civilian law enforcement constitutes permissible training of civilians. Congress did not intend for the training exception to condone routine participation by military personnel in civilian law enforcement activities. Rather, Congress emphasized that the training and expertise exceptions “would not alter the traditional separation of the military from civilian law enforcement:” 1981 U.S.C.C.A.N. at 1792. Congress further explained that “[n]othing in [§ 373] contemplates the creation of large scale or elaborate training programs. Neither does the authority to provide expert advice create a loophole to allow regular or direct involvement of military personnel in what are fundamentally civilian law enforcement operations.” Id.
*148 In addition to permitting military personnel to train, advise, and maintain equipment for civilian authorities, Congress has authorized military personnel to engage in specific activities related to the enforcement of a handful of criminal laws. See 10 U.S.C. § 374(b). The blood test here neither falls within one of the categories of activities that can be performed by military personnel under § 374(b)(1)-(2) nor relates to the enforcement of any of the laws specified in § 374(b)(4).
Nor does the general catch-all provision in 10 U.S.C. § 374(c) aid the Government here. In that statute, Congress has authorized the Defense Secretary to
make Department of Defense personnel available to any Federal, State, or local civilian law enforcement agency to operate equipment for purposes other than described in subsection (b)(2) only to the extent that such support does not involve direct participation by such personnel in a civilian law enforcement operation unless such direct participation is otherwise authorized by law.
10 U.S.C. § 374(c) (emphasis added).
In
Al-Talib
we had occasion to consider whether military participation was “direct” enough to violate the Posse Comitatus Act. There, the Air Force transported from Nebraska to Virginia a car and drugs, which the Drug Enforcement Administration planned to use as bait in a drug sting. We concluded that this “use of military resources ... had no direct impact on the defendants whatsoever” and so did not constitute a violation of the Act.
Al-Talib,
This holding accords with Congress’s directive that the Secretary of Defense:
prescribe such regulations as may be necessary to ensure that any activity (including the provision of any equipment or facility or the assignment or detail of any personnel) under this chapter does not include or permit direct participation by a member of the Army, Navy, Air Force, or Marine Corps in a search, seizure, arrest, or other similar activity unless participation in such activity by such member is otherwise authorized by law.
10 U.S.C. § 375. It also comports with the legislature’s explicit rejection of a proposed provision that would have permitted military personnel to make arrests and seizures in furtherance of civilian enforcement of drug laws. See 1981 U.S.C.C.A.N. at 1793.
In sum, we interpret the Posse Comitatus Act and authorizing statutes in keeping with “the traditional American insistence on exclusion of the military from civilian law enforcement, which some have suggested is lodged in the Constitution.”
Walden,
B.
For two reasons, however, this holding does not assist Johnson. First, we cannot conclude that the blood test at issue in this case .violated the Posse Comitatus Act because the record does not establish that military personnel actually performed this blood test. We know only that the test was performed at the Armed Forces Institute. That alone does not suffice to prove a violation of the Posse Comitatus Act because Congress has expressly authorized the use of military equipment and facilities by civilian agencies. Absent proof that military personnel performed the test, we decline to find a violation — especially since it would be a violation of a criminal statute.
Furthermore, even if the blood test at issue here had been performed by military personnel in violation of the Posse Comitatus Act, we would affirm the district court’s denial of Johnson’s suppression motion. This is so because despite the important function
of
the Act in “upholding] the American tradition of restricting military intrusions into civilian affairs,” “[a]s a general matter, the exclusionary rule is not a remedy for violations of the [Act].”
Al-Talib,
Of course, “[s]hould there be evidence of widespread or repeated violations” of the Act, “or ineffectiveness of enforcement by the military, we will consider ourselves free to consider whether adoption of an exclusionary rule is required as a future deterrent.”
Walden,
Johnson argues that we can infer repeated violations from the fact that the U.S. Park Police has contracted with the Armed Forces Institute for the latter to perform blood tests. We disagree; just because a contract exists does not necessarily mean the conduct complained of here occurs frequently. In fact, the record in this case contains no evidence that the alleged violation is widespread or has occurred repeatedly. Therefore, even if the Posse Comitatus Act had been violated here, i.e., military personnel had tested Johnson’s blood, fashioning an exclusionary rule would not be appropriate in this case.
IV.
In the wake of the Supreme Court’s decision in United States v. Booker, Johnson filed a supplemental brief arguing that his sentence should be vacated and the case remanded for resentencing because he was sentenced under a mandatory rather than an advisory regime. Because Johnson’s plea agreement contained an appeal waiver, we requested supplemental briefing as to whether that provision of the plea agreement precludes Johnson from posing this challenge to his sentence on appeal.
A.
The plea agreement contains a standard appeal waiver, which states, in its entirety:
Your client and the United States knowingly and expressly waive all rights conferred by 18 U.S.C. § 3742 to appeal *150 whatever sentence is imposed, including any issues that relate to the establishment of the guideline range, reserving only the right to appeal from an upward or downward departure from the guideline range that is established at sentencing. Your client further reserves the right to appeal the Court’s denial of the pretrial Motions to Suppress. Nothing in this agreement shall be construed to prevent either your client or the United States from invoking the provisions of Federal Rule of Criminal Procedure 35, and appealing from any decision thereunder, should a sentence be imposed that exceeds the statutory maximum allowed under the law or that is less than any applicable statutory minimum mandatory provision.
The district court engaged in a detailed plea colloquy with Johnson as required by Fed.R.Crim,P. 11. The court specifically asked Johnson whether he understood that he would be sentenced under the Guidelines, and Johnson answered that he did. The court engaged in a lengthy discussion about the parameters of Johnson’s appeal waiver, which concluded:
The Court: You have limited rights of appeal now and you have a conditional guilty plea where you’re appealing the denial of your motion to suppress. But if you went to trial and were convicted by a jury, you would be able to appeal on any and all issues including your sentence. Do you understand that?
The Defendant: Yes.
The Court: Do you further understand that by entering a plea of guilty, if that plea is accepted by this Court, there will be no trial and you will have waived or given up your right to a trial as well as all those other rights that I advised you of? Do you understand that?
The Defendant: Yes.
The district court held Johnson’s sentencing hearing on April 16, .2004, two months before the Supreme Court decided
Blakely v. Washington,
Nor did Johnson raise a
Blakely
challenge in his briefs in this court — presumably because he could not claim that his sentence exceeded “the maximum sentence a judge may impose solely on the basis of the facts reflected in the jury verdict or admitted by the defendant,” i.e., that his sentence was based on judge-found facts.
Blakely,
*151 B.
Generally, we uphold the validity of appeal waivers.
United States v. Marin,
An appeal waiver “is not knowingly or voluntarily made if the district court fails to specifically question the defendant concerning the waiver provision of the plea agreement during the Rule 11 colloquy and the record indicates that the defendant did not otherwise understand the full significance of the waiver.”
Id.
(citation omitted). Even if the court engages in a complete plea colloquy, a waiver of the right to appeal may not be knowing and voluntary if tainted by the advice of constitutionally ineffective trial counsel.
United States v. Craig,
Furthermore, even a knowing and voluntary waiver of the right to appeal cannot bar the defendant from obtaining appellate review of certain claims. For example, because “a defendant who waives his right to appeal does not subject himself to being sentenced entirely at the whim of the district court[,] ... a defendant could not be said to have waived his right to appellate review of a sentence imposed in excess of the maximum penalty provided by statute or based on a constitutionally impermissible factor such as race.”
Marin,
C,
Johnson does not claim that the district court failed to question him about the appeal waiver during the plea colloquy; the court demonstrably did so. Johnson does not allege that he entered into the appeal waiver on.the advice of constitutionally ineffective counsel; and we have no reason to suspect defense counsel rendered constitutionally deficient assistance. Johnson does not contend that his sentence exceeded the statutory maximum or was based on a constitutionally impermissible factor such as race; quite clearly it was not. He does not challenge the constitutionality of his sentence; nor can he
*152
raise a Sixth Amendment claim because the district court imposed a sentence based only on facts Johnson admitted. He does not even argue that a
Booker
challenge falls within one of the explicit exceptions contained in his appeal waiver; and other circuits have refused to read identical waiver language to accommodate such a claim.
See, e.g., United States v. Rubbo,
Rather, Johnson contends that he did not knowingly and intelligently agree to waive an appeal under Booker because his Booker challenge exceeds the scope of his appeal waiver. He argues that he could not have knowingly and intelligently waived his right, to challenge his sentence under Booker because at the time he pled guilty, “[njeither the [c]ourt, the Government, [n]or [he had] anticipated or had basis to anticipate” that the Supreme Court would subsequently hold the Guidelines advisory rather than mandatory. Supp. Brief of Appellant at 5. For this reason, according to Johnson, his Booker challenge exceeds the scope of his appeal waiver. 2
Johnson’s contention — that a defendant cannot waive the right to an appeal based on subsequent changes in the law- — though reasonable, is foreclosed by Supreme Court precedent. Years ago in
Brady v. United States,
the Court held that “absent misrepresentation or other impermissible conduct by state agents, a voluntary plea of guilty intelligently made in the light of the
then applicable law
does not become vulnerable because later judicial decisions indicate that the plea rested on a faulty premise.”
At the time Brady had pled guilty to kidnapping in violation of 18 U.S.C. § 1201(a), the statute specified that a jury-but not a judge — could impose the death penalty upon finding the defendant guilty.
Brady,
[a] plea of guilty triggered by the expectations of a competently counseled defendant that the State will have a strong case against him is not subject to later attack because the defendant’s lawyer correctly advised him with respect to the then existing law as to possible penalties but later pronouncements of the courts, as in this case, hold that the maximum penalty for the crime in question was less than was reasonably assumed at the time the plea was entered.
Id.; see also United States v. Ruiz,
Although Johnson, unlike Brady, challenges the viability of only a provision of his plea agreement rather than his entire guilty plea, the
Brady
reasoning applies equally here.
See, e.g., United States v. Johnson,
A plea agreement, like any contract, allocates risk.
See United States v. Ringling,
In sum, the issuance of .Booker after the plea agreement was reached does not render Johnson’s plea unknowing or involuntary, nor does Johnson’s Booker challenge fall beyond the scope of his pre-Booker appeal waiver.
V.
For the reasons stated above, we affirm the judgment of the district court and dismiss Johnson’s challenge to his sentence.
*154 AFFIRMED IN PART AND DISMISSED IN PART
Notes
. We note that the district court found that Officer Bentivegna "opened the unlocked glove compartment in order to locate identification information, including vehicle registration, to assist with the investigation of the traffic accident,” but did not specify the purpose of this "investigation.” Of course, a traffic accident investigation could involve a search for evidence of criminal wrongdoing, in which case the community-caretaking exception would not apply. However, as the Supreme Court has explained, police also “frequently investigate vehicle accidents in which there is no claim of criminal liability,” and the community-caretaking exception may apply in such situations.
Dombrowski, 413
U.S. at 441,
. Johnson also briefly argues that dismissal of his
Booker
challenge would result in a miscarriage of justice. The sole support offered for this contention is our statement in
United States v. Hughes,
