40. The grant or refusal to grant bail lies within the discretion of the court. The grant or denial is regulated, to a large extent, by the facts and circumstances of each particular case. But at the same time, right to bail is not to be denied merely because of the sentiments of the community against the accused. The primary purposes of bail in a criminal case are to relieve the accused of imprisonment, to relieve the State of the burden of keeping him, pending the trial, and at the same time, to keep the accused constructively in the custody of the court, whether before or after conviction, to assure that he will submit to the jurisdiction of the court and be in attendance thereon whenever his presence is required .