
879 So.2d 1269 (2004)
Richard REYES, Petitioner,
v.
Charles McCRAY, Director, Dade Co. Dept. of Corr., Respondent.
No. 3D04-806.
District Court of Appeal of Florida, Third District.
August 11, 2004.
Juan De Jesus Gonzalez, Miami, for appellant.
Charles J. Crist, Jr., Attorney General, and Jill K. Traina, Assistant Attorney General, for appellee.
Before RAMIREZ and SHEPHERD, JJ., and COBB, WARREN H., Senior Judge.
*1270 PER CURIAM.
This case comes before us on the petition of Richard Reyes for a writ of habeas corpus. We have jurisdiction. Art. V, § 4(b)(3), Fla. Const.
On January 6, 2004, the Petitioner, Richard Reyes, was arrested on one count of unlawful cultivation of marijuana and one count of unlawful possession of marijuana, both in violation of § 893.13, Fla. Stat. (2003). Petitioner was released on bond. On January 27, 2004, Reyes appeared without counsel for arraignment. At the arraignment, before petitioner was given the opportunity to enter a formal plea, the court sua sponte ordered Reyes to submit to an immediate drug test with the stern warning, "You better be clean." Reyes tested positive for cocaine and was taken into custody. On February 4, 2004, Reyes appeared with counsel at a second arraignment. Petitioner's counsel moved the court to either reinstate the original bond or impose a new bond with new conditions. The court refused noting that Reyes committed a new offense by testing positive for drugs the week before. Thereafter, Petitioner's counsel lodged a petition for writ of habeas corpus with this court on the above facts. We grant the petition.
The State argues that the language of the bail contract signed by Petitioner in this case which requires that he "shall submit to orders and process of said Court and not depart from same without leave...." provides the authorization necessary for the sua sponte drug testing of the accused in this case. We disagree. The record reflects that at no time prior to or during the January 27 hearing was the Defendant charged with violating a court order or court decorum. Nor is there any evidence or findings by the trial court that the Defendant was in any way impaired at the hearing. As we read this condition of the bail bond contract, the Defendant must simply comply with orders relating to the proceeding at hand. The provision does not authorize a trial judge to become a prosecutor, issuing orders without any cause whatsoever, not to mention probable cause.
In a perversion of logic, the State also seeks to justify the trial court's action by reference to § 903.0471, Fla. Stat. (2000), which reads:
Notwithstanding § 907.041, a court may, on its own motion, revoke pretrial release and order pretrial detention if the court finds probable cause to believe that the defendant committed a new crime while on pretrial release.
However, probable cause did not exist to take Petitioner into custody at the January 27 hearing. And, of course, it would be a violation of due process to manufacture it after the fact. See, e.g., Times Publ'g Co. v. Burke, 375 So.2d 297, 299 (Fla. 2d DCA 1979) (after the fact determination that First Amendment protection was unavailable did not suffice to afford reporter due process when reporter was called to testify regarding investigation without notice or subpoena). Furthermore, if, as it appears may be the case from the State's briefing, the State seeks to justify the trial court's action on the grounds of drug-related or other criminal activity that preceded the instant incident, that likewise fails constitutional muster. See State v. Van Pieterson, 550 So.2d 1162 (Fla. 1st DCA 1989) (application for search warrant that included a recitation of past criminal history insufficient). Indeed, the Petitioner's past conduct should have been and presumably was considered when he was first released on bond. Fla. R.Crim. P. 3.131(b)(3); Harp v. Hinckley, 410 So.2d 619, 624 (Fla. 4th DCA 1982).
We make no comment here on the rights or obligations of the trial judge had some ongoing criminal activity been evident *1271 from Petitioner's conduct at the hearing. Nevertheless, for the reasons explained in this opinion, we grant the petition for writ of habeas corpus, and direct that the detention based upon the sua sponte drug test ordered by the trial court be vacated.
