When a person has been arrested and brought before the city court, or the judge thereof, charged with an offense within the jurisdiction of the court, he or she shall be immediately tried or, at the discretion of the judge, held to bail for his or her future appearance for trial, or discharged from custody.