
    A91A2026.
    THE STATE v. HERNANDEZ-CUEVAS.
    (415 SE2d 713)
   Andrews, Judge.

After the defendant was remanded to the trial court for retrial pursuant to a successful habeas corpus petition, the trial court entered an order acquitting the defendant because the State failed to retry him within time limitations specified by the habeas court. The State appeals from the order of acquittal.

The defendant was indicted in Clayton County in 1986 for trafficking in cocaine and giving a false name to a law enforcement officer. In January 1987, the defendant was found guilty by a jury on both charges, and his convictions were affirmed on appeal in Hernandez v. State, 185 Ga. App. 704 (365 SE2d 867) (1988). On May 9, 1990, the Superior Court of Dodge County, where the defendant was serving his sentence, granted the defendant’s petition for a writ of habeas corpus. The habeas court found that under the ruling in Lockwood v. State, 257 Ga. 796 (364 SE2d 574) (1988), which was decided subsequent to Hernandez, supra, and given retroactive application, there was reversible error in the defendant’s trial requiring that the writ of habeas corpus be granted. The habeas court further ordered that “[t]he State shall have 120 days from the date of this order to retry the Petitioner or to release him from custody.” The State appealed the grant of the writ, and the Supreme Court affirmed the habeas court in Scott v. Hernandez-Cuevas, 260 Ga. 466 (396 SE2d 900) (1990), decided on October 18, 1990.

On November 5, 1990, the habeas court signed a judgment on the remittitur transmitted from the Supreme Court and in the judgment ordered “that the Petitioner be released from custody within 60 days from the date of this order unless he is transported to the Clayton County Jail to stand trial for the underlying charges involved in this action within said 60 days.” Pursuant to an order entered by the Clayton County trial judge on November 19, 1990, the defendant was transported to the Clayton County Jail.

In March 1991, the defendant filed two motions in the trial court claiming that the May 1990 order of the habeas court requiring the State to retry him within 120 days was similar to a demand for trial under OCGA § 17-7-170, and that the State’s failure to retry him within that period denied him due process of law and required that he be released from custody or acquitted. On April 11, 1991, the trial court entered an order on the motions ruling that the habeas court’s order of November 5, 1990, “direct[ed] the Defendant’s release from custody unless transported and tried within 60 days of November 5, 1990.” The trial court further held that the failure to retry the defendant within the 60-day period was the equivalent of the State’s failure to comply with a statutory demand for speedy trial under OCGA § 17-7-170. Accordingly, the trial court treated the motions as a plea in bar, and ordered the defendant acquitted of the charges in the indictment. See State v. Benton, 246 Ga. 132 (269 SE2d 470) (1980).

We find the trial court erred in treating the motions as the equivalent of an OCGA § 17-7-170 plea in bar, and in acquitting the defendant of the charges. The issue for the habeas court was whether the defendant’s confinement was legal at the time of the hearing. Stynchcombe v. Hardy, 228 Ga. 130, 131 (184 SE2d 356), (1971); Taylor v. Ault, 229 Ga. 572, 573 (192 SE2d 899) (1972). Where the writ of habeas corpus is granted for a defect in the trial, the effect is not to exonerate the defendant of the charges in the indictment and entitle him to be released, but to invalidate the defendant’s confinement under the existing judgment and sentence, and remand him to the trial court for retrial. See Brown v. Smith, 223 Ga. 433, 434 (156 SE2d 28) (1967); Patton v. State, 111 Ga. App. 853, 854 (143 SE2d 518) (1965).

Under these circumstances, the habeas court has the authority to order that the defendant be remanded to the custody of the trial court, and that unless this transfer is accomplished within a reasonable time the defendant may be released from his present confinement. See OCGA § 9-14-48 (d); Balkcom v. Vickers, 220 Ga. 345, 346 (138 SE2d 868) (1964) (judgment granting writ of habeas corpus for denial of counsel at sentencing contained provision that defendant be released from present confinement if trial court did not take custody of him within ten days). However, it is beyond the authority of the habeas court to direct that the defendant be retried by the trial court within a certain period of time. See Balkcom v. Hurst, 220 Ga. 405-406 (139 SE2d 306) (1964) (habeas court without authority to make any disposition other than to remand the defendant to the custody of the trial court); Balkcom v. Williams, 220 Ga. 359, 360-361 (138 SE2d 873) (1964) (habeas court’s attempt to direct trial court to give defendant credit for time served was beyond its authority and a nullity).

At least as to the order of November 5, 1990, it is not clear that the habeas court intended to direct that the defendant be released by the trial court unless he was actually retried within the stated time period. Nevertheless, any attempt to so direct the trial court was a nullity. The State’s failure to retry the defendant within the time limits stated by the habeas court was not a basis for his acquittal. See Ingram v. Rutledge, 245 Ga. 839, 840 (268 SE2d 333) (1980). Appellee’s motion to dismiss the appeal is denied.

Decided February 17, 1992.

Robert E. Keller, District Attorney, Daniel J. Cahill, Jr., Assistant District Attorney, for appellant.

Ellison & Moore, Coatsey Ellison, Cowen & Cowen, Martin L. Cowen III, for appellee.

Judgment reversed.

Sognier, C. J., and McMurray, P. J., concur. 
      
       Since the defendant’s motions were not properly a plea in bar, the State’s authority to appeal from the trial court’s order is not found under OCGA § 5-7-1 (3). However, in addition to the provisions of OCGA § 5-7-1, the state may directly appeal from an illegal order or judgment. State v. Bilal, 192 Ga. App. 185 (384 SE2d 253 ) (1989).
     