A court that issues a writ without requiring the production of the person or that issues a warrant may also, at any time before final decision, issue a precept to the peace officer to whom the writ or warrant is directed commanding the officer to immediately bring the person for whose benefit the writ was allowed before the court. That person shall remain in the custody of the peace officer until discharged, remanded, or the matter is otherwise disposed of as law and justice require.