The general procedure for a discharge petition in trial courts is as follows: 1. *Filing the petition*: The accused or their lawyer files a discharge petition in the trial court, stating the grounds for discharge. 2. *Notice to prosecution*: The court issues a notice to the prosecution to respond to the petition. 3. *Prosecution's response*: The prosecution files a reply to the petition, opposing the discharge. 4. *Arguments*: Both sides present their arguments before the court. 5. *Court's decision*: The court considers the petition, response, and arguments, and passes an order either allowing or rejecting the discharge petition. 6. *Reasons for rejection*: If rejected, the court provides reasons for rejecting the discharge petition. 7. *Right to appeal*: The accused has the right to appeal against the rejection of the discharge petition to a higher court. Grounds for discharge may include: - Lack of evidence - Illegal arrest or detention - Malicious prosecution - Violation of constitutional rights - Delay in trial - Other legal grounds Note: The specific procedure may vary depending on the jurisdiction and local laws.