
671 S.E.2d 506 (2009)
LAMB
v.
BENNETT.
No. S08A2006.
Supreme Court of Georgia.
January 12, 2009.
Clyde Lamb, Brunswick, pro se.
Aaron W. Mumford, Will Worley, for appellee.
BENHAM, Justice.
Petitioner Clyde Lamb is confined in lieu of bond in the Glynn County Detention Center in the custody of appellee Sheriff Wayne Bennett while he awaits trial on charges of theft by taking and theft by receiving. Lamb's pre-trial petition for a writ of habeas corpus was dismissed and, as a prisoner awaiting trial and in custody in lieu of bond, Lamb is entitled to a direct appeal from the dismissal of his petition seeking habeas relief. OCGA § 9-14-22; Smith v. Nichols, 270 Ga. 550(1), 512 S.E.2d 279 (1999).
In a verified response, the sheriff admitted Lamb has been held in custody since his arrest in 2007 on criminal arrest warrants for charges which remain pending; denied that Lamb's incarceration is the result of a judgment of conviction; and asserted that bond has been set for all the charges. Lamb contends he is being illegally detained because the charges were resolved in magistrate court in December 2007, when he agreed to a plea agreement that called for imposition of a probated sentence. He seeks *507 enforcement of the purported plea agreement.
The habeas court did not err when it dismissed Lamb's petition since there is no need to issue a writ when the criminal charges remain pending and petitioner has an adequate remedy at law, i.e., he may pursue a motion to enforce the purported plea agreement in the trial court before which the charges currently pending against him will be tried, as well as in any appeal of a judgment of conviction entered against him on the pending charges. Tabor v. State, 279 Ga. 98, 610 S.E.2d 59 (2005). See Kohlhaas v. State, 284 Ga.App. 79, 85-86, 643 S.E.2d 350 (2007); Palmer v. State, 260 Ga.App. 670(2), 580 S.E.2d 539 (2003).
Judgment affirmed.
All the Justices concur.
