One of the common practices in this cruel world is that people involve their enemies in criminal cases to rule them. They make them beg for mercy because whenever a good person gets involved in a criminal case, he/she wishes to get rid of that case at the first instance.
Another aspect is that the police officials at times involve people frivolously in criminal cases by Lodging FIR or complaints against them. That is one of the most evil ways adopted by corrupt officials to achieve ulterior motives.
Once FIR is lodged or complaint is registered against a person, he/she gets involved in a criminal case. There are certain ways to get rid of a criminal case. The best is quashment of FIR which is done by the High Court under section 561-A of the code of criminal procedure 1898.
Another way is that the magistrate has powers to discharge a person under section 63. Similarly petition under section 249-A can be moved at any stage of the trial for acquittal of accused. If the offense is trialed by the sessions court than a petition under section 265-K of code of criminal procedure is filed to get the accused acquitted by the court of law.