
655 P.2d 864 (1982)
STATE of Hawaii, Plaintiff-Appellee,
v.
Arturo MERJIL, Defendant-Appellant.
No. 7876.
Supreme Court of Hawaii.
December 28, 1982.
*866 Daphne Barbee, Deputy Public Defender, Honolulu (Michael Tanigawa, Deputy Public Defender, Honolulu), for defendant-appellant.
Arthur E. Ross, Deputy Pros. Atty., Honolulu, for plaintiff-appellee.
Before RICHARDSON, C.J., NAKAMURA, J., MARUMOTO, Retired Justice, in place of LUM, J., excused, and OGATA and MENOR, Retired Justices, assigned temporarily.
RICHARDSON, Chief Justice.
Defendant appeals from his conviction of promoting harmful drugs in the third degree. He asserts that a search of his anal cavity by customs officers contravened his right to be free from unreasonable searches and seizures, that the instructions in the court order authorizing the search were not followed, and any consent he gave was obtained under duress. We reverse.

I.
Defendant arrived in Honolulu at 11:00 a.m. on April 10, 1980, after a trip to Asia with a companion. He passed through customs inspection and waited in a lounge in the customs area. His companion aroused the suspicions of the customs officers who looked in her diary and found references to defendant and drugs. A customs officer went over to defendant and asked him to go to a search room. The officer conducted a pat-down search which revealed nothing. Noticing that defendant was nervous, the officer told him to remove his shirt. The officer saw what he believed were recent needle marks on defendant's arms, and therefore conducted a strip search. The officer suspected that defendant was hiding something in his anal cavity because defendant's anal area was shiny, indicating the use of a lubricant, he took short steps, and sat uncomfortably.
At 12:30 p.m. that day, the custom officers decided to attempt to obtain a warrant for a body cavity search. An affidavit was submitted at 5:45 p.m. and a United States Magistrate issued an order the next day at 9:25 a.m. During this time defendant and his companion were kept in a small, supervised room, which was brightly lit at all times and furnished with only a two-seat couch, a few chairs and a desk. Defendant suffered from a back ailment and took many doses more than usual of methadone to relieve the pain. This made him drowsy.
After receiving the court order, the officers took defendant to a hospital. The court order stated:
IT IS HEREBY ORDERED that:
1) [Defendant's companion] and Arturo G. Merjil submit, without resistance, to an X-ray examination of their abdominal areas; and
2) That if such X-ray is positive for foreign matter in their body cavities that they submit without resistance to a body cavity search or be retained under the care of a qualified physician at Queens Medical Center or other available hospital until such time that such foreign or contraband matter is evacuated and the safety of the defendants is assured.
The order, in sum, instructs the officers to take an x-ray, and proceed only if they observe foreign matter in the body.
*867 At the hospital a customs officer read and explained the court order to defendant at 12:15 p.m. Defendant first called his attorney in California, then refused to submit to the x-ray or other search. There were several customs officers present with defendant at the hospital. They did not try to force defendant to submit to any search. At 3:15 p.m. defendant admitted that he had some hashish in a balloon in his anal cavity and would attempt to pass it himself. When this proved unsuccessful, defendant agreed to allow a doctor to perform a digital examination at 3:30 p.m., which also failed to produce the hashish. Finally defendant agreed to an enema which caused the evacuation of the hashish at 3:50 p.m. An x-ray was performed after the enema and showed no foreign material in defendant.
Defendant was tried in state court for promoting harmful drugs.[1] The court denied his motion to suppress the evidence of the hashish, and defendant was convicted.

II.
The protections of the fourth amendment of the United States Constitution apply to searches at the border, although not to the same extent as non-border searches. Carroll v. United States, 267 U.S. 132, 150, 45 S.Ct. 280, 284, 69 L.Ed. 543 (1925). A search at the border may proceed without a warrant if based on mere suspicion. United States v. Ramsey, 431 U.S. 606, 97 S.Ct. 1972, 52 L.Ed.2d 617 (1977). Compare, New York v. Belton, 453 U.S. 454, 457, 101 S.Ct. 2860, 2862, 69 L.Ed.2d 768 (1981) (police may not conduct a non-border search unless they convince a neutral magistrate that there is probable cause to do so). To conduct a body cavity search, however, there must be a clear indication that contraband will be found. Rivas v. United States, 368 F.2d 703 (9th Cir.1966). Also, any such intrusive search must be conducted in a reasonable manner. United States v. Cameron, 538 F.2d 254 (9th Cir.1976).
The Ninth Circuit Court of Appeals, which has decided many border search cases, has considered several cases concerning body cavity searches at the border. Although that court has not adopted a mandatory rule requiring warrants in such searches, it has said "[W]e have noted the failure to obtain a warrant in the course of determining such a search to have been conducted in an unreasonable manner. Huguez v. United States, 406 F.2d 366, 374-79 (9th Cir.1969)." Id. at 258. That court has explained that a warrant can help assure that the search will be carried out in a reasonable manner, will define the scope of the search, and will help to obtain the cooperation of an otherwise unwilling detained person by demonstrating the legality of the search. Id. at 259. We adopt this view here, and stress that we will regard a warrant as an important factor in considering the reasonableness of a border search.
This court has recently recognized that body cavity searches constitute a special intrusion and require greater restraint. State v. Clark, 654 P.2d 355 (Haw. 1982) (warrantless body cavity search may proceed only upon a clear indication that evidence will be found, and an emergency exists). We therefore agree with the Ninth Circuit which has held that a body cavity search at the border must be conducted so as to use the least intrusive means reasonably possible, and be done with regard to the person's privacy and emotional state. United States v. Cameron, 538 F.2d 254, 258 (9th Cir.1976).
Our task here is to decide whether this search was reasonable and was conducted with the least intrusive means. After considering the effect of the warrant, the validity of the consent, and the circumstances of defendant's confinement and search, we conclude that this search was unreasonable.

A.
We first discuss the issue of the court order. Although a magistrate issued a court order allowing a search in this case, *868 the order's instructions were not followed. The order stated that defendant was to submit to an x-ray, and only if this revealed any foreign matter were the officers to conduct a more intrusive search. Here, the digital exam and the enema were performed before the x-ray.
A search warrant allows the government to reasonably search a limited area to uncover what is particularly described in the warrant. State v. Nabarro, 55 Haw. 583, 525 P.2d 573 (1974). It follows, therefore, that where the warrant sets out a procedure by which to conduct the search, the government must reasonably adhere to that procedure. The procedure was not followed here, so the government may not rely on the court order to justify the search.
The deviation from the instructions of the court order is significant and not a mere technical error. The ordered procedure was designed to minimize the intrusion into the body. Since the court order was not followed, we will not consider it in evaluating the reasonableness of the search.

B.
We turn next to the question of whether defendant consented to this search. The State contends that defendant waived the protection of the x-ray and consented to the search. Defendant asserts that his consent was involuntary, and was the result of duress due to his long and uncomfortable confinement.
The government may conduct a search which violates the fourth amendment if the person searched consents. Washington v. Chrisman, 455 U.S. 1, 9, 102 S.Ct. 812, 818, 70 L.Ed.2d 778 (1982); State v. Texeira, 50 Haw. 138, 140, 433 P.2d 593, 596 (1967). The consent must be voluntary and uncoerced, Nakamoto v. Fasi, 64 Haw. 17, 21, 635 P.2d 946, 951 (1981), and the government bears the burden of proving that the consent was voluntary. State v. Patterson, 58 Haw. 462, 468, 571 P.2d 745, 749 (1977). "[W]hether a consent to a search was in fact `voluntary' or was the product of duress or coercion, express or implied, is a question of fact to be determined from the totality of all the circumstances." Schneckloth v. Bustamonte, 412 U.S. 218, 227, 93 S.Ct. 2041, 2047, 36 L.Ed.2d 854 (1973).
Some factors relevant to voluntariness identified by other courts are length of detention and lack of sleep or food. United States ex rel. Daley v. Yeager, 415 F.2d 779, 784 (3rd Cir.1969); State v. Johnson, 16 Wash. App. 899, 903, 559 P.2d 1380, 1383 (1977). Here defendant was kept in a brightly-lit, supervised room at the airport for more than twenty hours with no comfortable place to sleep. He was then held at the hospital for many hours. This distressful atmosphere might in itself be coercive. Added to this is the fact that it was known to the customs officers that defendant was on medication for a back ailment and consumed many doses of methadone which made him drowsy.
We find that defendant did not voluntarily waive the protection of the x-ray. We note that one is more likely to waive an x-ray than consent to a search where one knows that the x-ray will reveal contraband. A detained person may want to get on with the inevitable search. The facts here, however, show a continued unwillingness by defendant. When told he would be subjected to the x-ray, defendant at first refused. The officers then did nothing to enforce the order and waited with defendant for three hours. By this time defendant had been in custody for over twenty-seven hours. Nothing in the record dispels the impression that the officers intended to hold defendant until he consented, nor gives a reason for defendant voluntarily changing his mind. We conclude that the waiver was coerced and did not allow the officers to ignore the court order's instructions.
Turning to the search, we hold that the consent for it was also given under duress. This is based on an evaluation of all the facts described above. Another consideration is that the presence of the warrant may have caused defendant to believe that his consent was without real consequence. We have strong reservations with *869 regards to the practice of obtaining and relying on consent after a warrant has been issued. This is likely to confuse a person who will not know whether he is acquiescing to the search warrant or consenting to a search beyond its scope. See Bumper v. North Carolina, 391 U.S. 543, 549, 88 S.Ct. 1788, 1792, 20 L.Ed.2d 797 (1968) ("A search conducted in reliance upon a warrant cannot later be justified on the basis of consent if it turns out that the warrant was invalid.") We hold therefore, that defendant's consent was given under duress and may not be used to validate the search.

C.
As explained above, we can find this search permissible only if there was a clear indication that contraband would be found, and the search was conducted reasonably and by the least intrusive means. We need not decide whether there was a clear indication of contraband, because we conclude that this search was unreasonable and not done with the least intrusive means.
Inasmuch as the search was made without an effective warrant or consent, we must look at the circumstances of defendant's detention and search. The search was not done by the least intrusive means because the officers did not conduct an x-ray. An x-ray would have protected defendant from an intrusive but futile search.
The search was conducted unreasonably in that defendant was detained for an unreasonable length of time. Since a person may be detained at the border on less than probable cause, it is imperative that officers do not act dilatorily in securing a warrant and conducting the search. Twenty-seven hours is too long, especially considering the fact that the time might have been longer had not defendant been coerced to consent. We hold, therefore that this search was unreasonable.
The search here being impermissible, the court below erred in not suppressing the evidence found in the search. The conviction of defendant is reversed and the case is remanded for proceedings not inconsistent with this opinion.
NOTES
[1]  At oral argument, the prosecution explained that the federal authorities turned the case over to the local police because of the small amount of drugs involved.
