If it should appear upon the whole examination that no offense has been committed, or that there is not probable cause for charging the defendant with an offense, he or she shall be discharged, and if in the opinion of the magistrate, the complaint was malicious, or without probable cause, and there was no reasonable ground therefor, the costs shall be taxed against the party making the complaint.