
620 S.E.2d 798 (2005)
279 Ga. 691
The STATE
v.
JARAMILLO.
No. S05A1188.
Supreme Court of Georgia.
October 3, 2005.
*799 Jeffrey Paul Kwiatkowski, Asst. Solicitor-General, Gerald N. Blaney, Jr., Solicitor-General, for Appellant.
Kunle Ogundele, Atlanta, for Appellee.
BENHAM, Justice.
In this appeal from an order granting habeas corpus relief to Filiberto Jaramillo, the State raises a single procedural issue, arguing the habeas corpus court should have dismissed the petition for failure to serve the district attorney pursuant to OCGA § 9-14-45. Because the State failed to raise that alleged insufficiency of service in a timely manner, we deem it to have waived the defense and affirm the judgment below.
Jaramillo pled guilty to a misdemeanor in state court in 1999 and completed the sentence imposed. In 2004, Jaramillo filed a petition for a writ of habeas corpus in the superior court of the county in which the conviction occurred, naming the State of Georgia as respondent and serving the petition on the solicitor-general of that county. In the petition, Jaramillo explained that his motivation in seeking relief was to avoid deportation. In its response, filed by an assistant solicitor-general, the State argued it was not the proper party because it had no interest in the consequences of the conviction. The only reference in the response to service of process was an assertion that the provisions of OCGA § 9-14-45, to which Jaramillo made reference in his petition to explain service of process on the solicitor-general, do not apply to this case because Jaramillo is not currently incarcerated.[1] When the State asserted at the hearing on the petition that the proper party to be sued was the agency of the United States government seeking Jaramillo's deportation, the habeas corpus court deemed the argument to be an oral motion to dismiss, continued the hearing, and directed counsel to brief the issue. In its brief, the State advanced the argument that it was not the proper party and also argued for the first time that service was insufficient because Jaramillo did not serve an additional copy of the petition on the district attorney pursuant to OCGA § 9-14-45. When the hearing resumed, the habeas corpus court denied the motion to dismiss without explanation and granted the relief sought by Jaramillo. The State, by the solicitor-general who defended against the petition, filed this appeal with a single enumeration of error: "The Habeas Judge improperly granted the habeas corpus petition because it was not properly served upon the District Attorney as required by law."
1. Although the State did not directly raise on appeal its arguments that the petition should have been filed elsewhere against a different respondent, we note that the petition was proper in both regards. "When a habeas petitioner who seeks to challenge a Georgia conviction is not incarcerated by the Georgia Department of Corrections, his habeas corpus petition should be filed *800 against the State of Georgia." Capote v. Ray, 276 Ga. 1, 3(3), 577 S.E.2d 755 (2002). "[A] person who is not incarcerated anywhere can attack an old conviction, and in such a case the place of restraint, the equivalent of `illegal detention,' would be the place of conviction. That is where the record ultimately will have to be corrected if the petitioner prevails." Smith v. State, 234 Ga. 390, 392, 216 S.E.2d 111 (1975). The solicitor-general of the state court in which a misdemeanor conviction occurred is the proper representative of the State in an action attacking the conviction by means of a petition for habeas corpus. OCGA § 15-18-66(b)(7) (the solicitor-general of a state court is authorized "[t]o represent the state or any officer or agent of the county in a superior court in any habeas corpus action arising out of any criminal proceeding in the state court, except in those cases in which the commissioner of public safety is named as a party").
2. For the purpose of addressing the enumeration of error asserted by the State in this appeal, we will assume without deciding that OCGA § 9-14-45 calls for service of an additional copy of the petition on the district attorney in the circumstances of this case. The State's argument, then, is that failure to serve the district attorney constituted insufficient service of process. The Civil Practice Act, OCGA § 9-11-1 et seq., applies in habeas corpus proceedings with regard to questions of pleading and practice. Nelson v. Zant, 261 Ga. 358(1), 405 S.E.2d 250 (1991). Under the CPA, failure to raise insufficiency of service either in the answer or by motion filed before or simultaneously with the answer constitutes a waiver of that defense. Whitley v. Hsu, 260 Ga. 539, 397 S.E.2d 694 (1990). The State did not assert in its answer the failure to serve the district attorney and first questioned the sufficiency of service in this case in a brief filed in the habeas corpus court in support of a motion to dismiss made on another ground. Since the defense was not raised in the answer or in a motion filed with or before the answer, the defense was waived and the habeas corpus court was correct in refusing to dismiss the petition on that ground.
Jaramillo's request for a penalty for a frivolous appeal is denied.
Judgment affirmed.
All the Justices concur.
NOTES
[1]  OCGA § 9-14-45 provides:

Service of a petition brought under this article shall be made upon the person having custody of the petitioner. If the petitioner is being detained under the custody of the Department of Corrections, an additional copy of the petition shall be served on the Attorney General. If the petitioner is being detained under the custody of some authority other than the Department of Corrections, an additional copy of the petition shall be served upon the district attorney of the county in which the petition is filed. Service upon the Attorney General or the district attorney may be had by mailing a copy of the petition and a proper certificate of service.
