[¶ 1] Dаvid Ullring appeals from the judgment of conviction for trafficking in marijuana entered in the Superior Court (Franklin County, Warren, J.). Ullring contends that it was error for the court (Harden, J.) to deny his motion to suppress. He also argues that the evidence at trial did not support a verdict of guilt beyond a reasonable doubt. We affirm the conviction.
[¶ 2] On December 5, 1997 Ullring’s home was searched, pursuant to a search warrant, by six law enforcement officers, most of whom were agents of the Maine Drug Enforcement Administration (MDEA). Ullring was not home when the search was conducted. The officers found approximately thirteen ounces of marijuanа, a triple beam scale and plastic sandwich bags. Ullring was arrested five days later and taken to the Franklin County jail where he was released after posting $400 bail and signing a bail bond. A condition of his bail required him to submit to random searches of his person, residence, and vehicle.
[¶ 3] On January 14, 1998, an MDEA agent returned to Ullring’s home to conduct a search. The agent did not have a warrant and had no evidence of any wrongdoing on the part of Ullring. The agent based his search on the authority created by Ullring’s bail condition. This search revealed that Ullring was in possession of four bаgs of marijuana, each containing one-eighth of an ounce, and $421 in cash. Ullring was arrested and appeared in court that same day. This was his first court appearance since his initial arrest on December 10.
[¶ 4] Ullring was indicted by the Franklin County grand jury on January *1067 28, 1998 on two counts of trafficking in marijuana in violation of 17-A M.R.S.A. § 1103 (Supp.1999) (Class D). The first count was alleged to have occurred on December 5, 1997 and the second count on January 14,1998. He was also indicted on one count of violation of bail conditions, 15 M.R.S.A. § 1092 (Supp.1999) (Class E). Prior to trial, Ullring filed a motion to suppress the evidence gathered from the second search of his home, and a motion to sever the charges arising from the January 14 search from the charge stemming from the December 5 search. The court denied both motions.
[¶ 5] Ullring was tried on all three of the charges. The jury returned a verdict of guilty on the offense of trafficking occurring on December 5, 1 and not guilty on both of the January 14 offenses.
[¶ 6] Even though Ullring was acquitted on both charges stemming from the search of his home on January 14, 1998, we must address the appeal of the denial of his suppression motion because the January 14 charges were tried together with the December 5 charge. If we were to conclude that the evidence from the January 14 search should have been excluded because the search violated Ullring’s constitutional rights, we would have to determine whether the unconstitutionally obtained evidence was harmless beyond a reasonable doubt.
See State v. Hassapelis,
I. LEGALITY OF THE JANUARY 14 SEARCH
[¶ 7] Ullring’s motion to suppress the evidence obtained from the January 14 search of his home and his person was submitted to the court on a written stipulation of facts. The parties agree that Ullr-ing was held in custody after his arrest on December 10, 1997 until he signed the bail bond. The bail bond is on a printed form. Immediately after the printed words “Additional conditions which I agree to obey are:” appear the following in handwriting: “No use or poss. of illegal drugs — no use + poss. firearms or other dangerous weapons — Must submit to random search and/or testing of person, residence and/or vehicle.” Both Ullring and the bail commissioner signed the bail bond. The parties stipulate that the only basis for the search of Ullring and his residence on January 14 was the bail condition and that the MDEA agent had no evidence of any wrongdoing by Ullring.
[¶ 8] We review the legal conclusions of the court on a motion to suppress
de novo,
although we review historical facts found by the court deferentially.
See State v. Storey,
A. Consent to Search
[¶ 9] The State argues that the January 14 search was pursuant to the consent of Ullring and that his consent was manifested by the bail bond and, in particular, his agreement to abide by the condition of random searches. Ullring argues that the bail condition is illegal because it is not authorized by statute and unconstitutional because it violates his rights under the Fourth Amendment of the United States Constitution.
[¶ 10] When the State relies upon consent as the justification for the lawfulness of a warrantless search, the State has the burden of proving that the consent was voluntary.
See Schneckloth v. Bustamonte,
[¶ 11] Ullring suggests that a defendant who is in custody and who is required to sign a bail bоnd with conditions before being released is signing the bond under coercion. The mere fact that Ullring was in custody at the time the consent was given does not demonstrate that the consent was coerced. See
United States v. Watson,
[¶ 12] We conclude that Ullring’s signature on the bail bond is a sufficient manifestation of his voluntary consent to the January 14 search provided that the condition itself is legal. Ullring argues that there was no consent to search because the bail commissioner had no authority to impоse the bail condition and the bail condition itself violated Ullring’s Fourth Amendment' rights. We agree that if the bail condition is unauthorized or unconstitutional, it cannot form the basis for the consent.
B. Bail Condition Authorized by Statute
[¶ 13] We next examine whether the bail condition requiring Ullring to submit to random searches of his residence and person is permitted by the Maine Bail Code, 15 M.R.S.A. §§ 1001-1104 (Supp. 1999). The legislative findings and statement of purpose for the bail code are as follows:
It is the purpose and intent of this chapter that bail be set for a defendant in order to reasonably ensure the appearance of the defendant as required, to otherwise reasonably ensure the integrity of the judicial process and, when applicable, to reasonably ensure the safety of others in the community. It is also the purpose and intent of this chapter that the judicial officer consider, relative to crimes bailable as of right preconviction, the least restrictive release alternative that will reasonably ensure the attendance of the defendant as required, or otherwise reasonably ensure the integrity of the judicial process. Finally, it is also the intent and purрose of this chapter that a defendant, while at liberty on bail, refrain from committing new crimes.
Id. at § 1002. Although the statement of purpose gives four purposes, only two are listed in the preconviction bail section: (1) ensure the appearance of the defendant; and (2) ensure the integrity of the judicial process. See § 1026. The setting of post-conviction bail, however, requires a judge to consider the other two purposes; that is, to ensure the safety of others in the community and to keep a defendant from committing new crimes while at liberty on bail. See § 1051(2).
*1069 [¶ 14] The bail code authorizes judicial officers to impose conditions on the pre-conviction release of persons on bail. See 15 M.R.S.A. § 1026(1)(C).
If the judicial officer determines that the release ... will not reasonably ensure the appearance of the defendant as required or will not otherwise reasonably ensure the integrity of the judicial process, the judicial officer shall order the pretrial release of the defendant subject to the least restrictive further condition or combination of conditions that the judicial officer determines will reasonably ensure the appearance of the defendant as required and will otherwise reasonably ensure the integrity of the judicial process.
§ 1026(3)(A). Judicial officers include both judges and bail commissioners. See § 1003(8). The phrase “ensure the integrity of the judicial process” is defined as:
safeguarding the role of the courts in adjudicating the guilt or innocence of defendants by ensuring the presence of the defendant in court and otherwise preventing the defendant from obstructing or attempting to obstruct justice by threatening, injuring or intimidating a victim, prospective witness, juror, attorney for the State, judgе, justice or other officer of the court.
§ 1003(5).
[¶ 15] There is no express authorization in the bail code for the imposition of a condition of submitting to random searches. On the other hand, there is nothing in the bail code that prohibits the condition. The bail code contains seventeen specific conditions that a judicial officer may include in a bail order. See § 1026(3)(A)(1)-(17). Included among these conditions are staying in the custody of a designated person or organization; maintaining employment; maintaining or commencing an educational program; abiding by restrictions on personal association, place of abode, and or travel; complying with a specified curfew; refraining from the possession of a firearm; and refraining from the use of alcohol or drugs. Id. Further, there is a “catch-all” provision which allows a judicial officer to require a defendant to “[s]atisfy any other condition that is reasonably necessary to ensure the appearance of the defendant as required and to otherwise reasonably ensure the integrity of the judicial process.” § 1026(3)(A)(18).
[¶ 16] Section 1026(4)(C) sets forth numerous factors that the judicial offiсer is required to review in setting bail such as the crime charged; the defendant’s criminal history and past conduct including drug or alcohol abuse; and the defendant’s ties to Maine. The judicial officer is to obtain the information on which to make the assessment from an interview with the defendant, information from the State, and the defendant’s attorney, and other reliable information. See § 1026(4). 3 No facts were presented in this case as to the *1070 information upon which the bail commissioner based the conditions which were imposed upon Ullring in the bail bond. 4
[¶ 17] The bail code specifically allows a judicial officer to require a person on preconviction release to refrain from the possession of firearms, alcohol, or drugs. See § 1026(3)(A)(7)-(9). The State argues that the only effective means of enforcing these conditions is to require the defendant to submit to random searches and testing.
[¶ 18] In
Oliver v. United States,
[¶ 19] In
York,
the California Supreme Court held that the bail statute permitted the imposition of bail conditions of war-rantless search and random drug testing. Although the statute did not expressly authorize the condition, it authorized a court or magistrate to impose “all reasonable conditions.”
York,
[¶ 20] We are not aware of any court which has struck a bail condition of random search on the grounds that the condition was not authorized by the bail statute. We are persuaded that the condition of random search is authorized by the catch-all provision of the Maine Bail Code, § 1026(3)(A)(18), when the judicial officer is of the opinion that (1) the defendant should be prohibited from possessing illegal drugs; (2) a condition of random search is necessary to ensure that the defendant will not violate other conditions; and (3) the сonditions of refraining from illegal drug possession and random search are the least restrictive alternative that reasonably will ensure the presence of the defendant and the integrity of the judicial process. Bail conditions which prohibit illegal drug use and authorize random searches can serve the purpose of ensuring the presence of the defendant in court. The bail condition of random search is not prohibited by the Maine Bail Code.
C. The Fourth Amendment
[¶ 21] Ullring argues that even if the bail condition allowing random searches of his' residence is permitted by the Maine Bаil Code, the condition violates his rights under the Fourth Amendment of the United States Constitution.
7
The courts that have decided this issue have found that similar bail conditions did not violate the Fourth Amendment rights of defendants. In
Oliver,
[¶ 22] Ullring argues that
Griffin v. Wisconsin,
[¶ 23]
Griffin
makes it clear that probationers do not give up their Fourth Amendment rights entirely, and if convicted felons who have been sentenced to probation do not give up such rights, people who have not been convicted but who are only charged with a crime do not give up such rights. Nonetheless, just as the needs and purposes of the probation system justify searches without probable cause, the bah system has similar purposes and needs. We do not read
Griffin
as requiring “reasonable grounds” before a search of a probationer’s home can be justified. Instead,
Griffin
stands for the proposition that probable cause is not required to search a probationer’s home because of the needs and purposes of the probation system.
Id.
at 875-76,
[¶ 24] The overriding purpose of the bail system in Maine is to ensure the appearance of the defendant at trial and to do so without incarceration as long as conditions can be imposed which will fulfill that purpose and the purpose of ensuring the integrity of the judicial process. Bail conditions, such as a prohibition against possession of illegal drugs and searches for illegal drugs, help to ensure that defendants whose backgrounds and charges indicate that substance abuse is a significant problem will show up at court. It is reasonable to expect that a defendant who maintains sobriety is more likely to appear *1073 in court on the appointed dates than a defendant who is under the influence of drugs or alcohol.
[¶ 25] A bail condition authorizing random searches can only meet Fourth Amendment scrutiny if the condition is reasonable under all of the circumstances. Just as a random search condition is not likely to be reasonable in every case, it is also nоt likely to be unreasonable in every case. There are situations in which the history and personal situation of the defendant, including the charges against him or her, justify a determination by a judicial officer that a random search condition is both necessary and the least restrictive alternative that will ensure the defendant’s appearance and the integrity of the judicial process.
[¶26] Furthermore, when a judicial officer makes such a determination and imposes a random search condition, we must assume, in the absence of evidence to the cоntrary, that the condition is reasonable. A defendant who seeks to challenge such a condition as being unreasonable has the burden of presenting evidence to demonstrate that the condition in that individual case is not reasonable. This is similar to the procedure that is utilized when a search is executed pursuant to a warrant and a defendant challenges the issuance of the warrant. When there is a warrant the defendant has the burden of proving its illegality.
See State v. Friel,
[¶ 27] Ullring presented no evidence to demonstrate that the bail condition was unreasonable in his case. Therefore, we conclude that the random search condition is not unconstitutional as applied to him. Because the Maine Bail Code authorizes the condition and because it is constitutional as applied to Ullring, we find that Ullring voluntarily consented to the search. The Superior Court did not err in denying the motion to suppress.
II. SUFFICIENCY OF THE EVIDENCE
[¶ 28] When reviewing challenges to the sufficiency of the evidence we review the evidence in the light most favorable to the State to determine whether a factfinder “ ‘rationally could find beyond a reasonable doubt every element of the offense charged.’”
State v. Marden,
A. To make, create, or manufacture;
B. To grow or cultivate;
C. To sell, barter, trade, exchange or otherwise furnish for consideration; or
D. To possess with the intent to do any act mentioned in paragraph C.
[¶ 29] The only witness in this case was MDEA agent David St.-Pierre. St. Pierre testified to his experience investigating drug cases as an MDEA agent and police officer. He testified that marijuana is usually sold in small quantities, such as one-eighth of an ounce, in baggies. He testified that triple beam scales are expensive and commonly used by marijuana traffickers to accurately weigh the small quantities to be sold. When St. Pierre and the other agents searched Ullring’s home on December 5, pursuant to the search warrant, they found a triple beam scale, plastic sandwich bags, and thirteen ounces of *1074 marijuana located together on a tray. St. Pierre testified that several empty one-pound ziplock bags were found next to the marijuana and the scales, and each of them emitted a strong odor of marijuana and contained marijuana residue.
[¶ 30] From this evidence a jury could rationally conclude that Ullring obtained or stored marijuana in the larger ziplock bags, and that he took marijuana from the larger bags and placed small quantities in the smaller bags, which he weighed with the triple beam scales. From that the jury could reach the rational inference that the purpose of weighing the smaller quantities was to ready them for sale. The jury could have found rationally beyond a reasonable doubt that Ullring possessed the marijuana with the purpose of selling it. Therefore, we will not disturb the jury’s verdict.
The entry is:
Judgment affirmed.
Notes
. Ullring was sentenced to six months in jail with all but 20 days suspended.
. There is no evidence that Ullring attеmpted to revoke his agreement to the random search condition or that he sought, from the court, a review of the bail condition.
. § 1026(4) states:
4. Factors to be considered in release decision. In setting bail, the judicial officer shall, on the basis of an interview with the defendant, information provided by the defendant’s attorney and information provided by the attorney for the State or an informed law enforcement officer if the attorney for the State is not available and other reliable information that can be obtained, take into account the availаble information concerning the following:
A. The nature and circumstances of the crime charged;
B. The nature of the evidence against the defendant; and
C.The history and characteristics of the defendant, including, but not limited to:
(1) The defendant’s character and physical and mental condition;
(2) The defendant’s family ties in the State;
(3) The defendant’s employment history in the State;
(4) The defendant’s financial resources;
(5) The defendant's length of residence in the community and the defendant’s community ties;
(6) The defendant’s past conduct, including any history relating to drug or alcohol abuse;
(7) The defendant’s criminal history, if any;
*1070 (8) The defendant’s record concerning appearances at court proceedings;
(9) Whether, at the time of the current offense or arrest, the defendant was on probation, parole or other releasе pending trial, sentencing, appeal or completion of a sentence for an offense in this jurisdiction or another;
(10) Any evidence that the defendant has obstructed or attempted to obstruct justice by threatening, injuring or intimidating a victim or a prospective witness, juror, attorney for the State, judge, justice or other officer of the court; and
(11) Whether the defendant has previously violated conditions of release, probation or other court orders, including, but not limited to, violating protection from abuse orders pursuant to Title 19, section 769 or Title 19-A, seсtion 4011.
.There is no indication in this record that Ullring sought judicial review of the conditions imposed by the bail commissioner. Ullring did not appear in court until Januaiy 14, 1998, and he did not have an attorney until one was appointed for him on January 14. The court has wide discretion to amend bail conditions upon motion of either party or at the defendant’s first appearance in court. See § 1026(3)(C) and (6).
. The
Oliver
court also relied upon the inherent power of the courts stating, ”[A]11 courts, absent some specific statutory denial of power, possess ancillary powers to effectuate thеir jurisdiction ... [and] do all things that are reasonably necessary for the administration of justice within the scope of its judgments and mandates.”
Oliver,
.
York
was a consolidated appeal of several habeas corpus petitions, the petitioners all being pretrial arrestees upon whom the conditions of warrantless search and random drug testing were imposed. The conditions were imposed routinely as a matter of policy on persons arrested for drug-related felonies.
See York,
. Ullring also argues that the bail condition violates article 1, section 5 of the Maine Constitution. We have refused to adopt a different or more stringent standard for searches under the Maine Constitution than is provided under the Fourth Amendment to the United States Constitution. In
State v. Patten,
. Neither
Oliver
nor
York
involve the precise situation in this case.
Oliver
involved only drug testing and not random searches of a residence. The statute allowed conditions "to protect public safety,”
Oliver,
. The Wisconsin Supreme Court ruled that the tip from the police constituted reasonable grounds under the regulation. The Supreme Court said that it was bound by the state court's interpretation of the state regulation.
Griffin,
