Order for Release of Accused can be pronounced at any stage, it can be prior or post trail order. When the trail has come to its end and the case is going to be decided on merits then the accused gets released with judgment if not found guilty.
In other cases where the magistrate comes to the conclusion at the very beginning of the case that the charges against accused are not to be made and the case and its story cannot convict the Accused. The Magistrate is veasted with power to release an Accused at any stage even before framing of charge or during the trail when the evidence of prosecution has been taken and the magistrate at such stage can pronounce the order of acquittal.
The high court and sessions court are vested with similar power and in most cases when such powers are not excercised by lower courts accused are approaching to high court for quashment of FIR where the high court considers the available facts and evidences And passes the order for quashment of FIR which results release of accused.