
738 So.2d 898 (1999)
In the Matter of D.M.
2971412.
Court of Civil Appeals of Alabama.
June 25, 1999.
Nancy S. Jones, Alabama Department of Mental Health and Mental Retardation.
Ronald J. Williams, Legal Aid Society of Birmingham, Inc., Bessemer, for D.M.
Paula F. Lampkin, Bessemer, guardian ad litem.
BEATTY, Retired Justice.
The Alabama Department of Mental Health and Mental Retardation (the "Department") appeals from an order directing it to use its funds to pay for D.M.'s placement in a specialized residential treatment facility. We reverse and remand.
On or about March 23, 1998, J.M. filed a petition with the Jefferson County Juvenile Court, Bessemer Division, asking the court to commit her minor son, D.M., to the custody and care of the Department. The petition alleged that D.M. was mentally ill and had been diagnosed with reactive attachment disorder; recurrent major depression; fetish disorder; and schizoid *899 avoidant personality traits; that on March 5, 1998, D.M. had threatened to kill himself and his parents; that he had threatened his own life and the lives of his parents many times before; that D.M. had threatened his classmates at school; that D.M. had broken into the homes of neighbors, had stolen female undergarments, and had masturbated while wearing the stolen undergarments; and that the owners of the houses D.M. had broken into considered D.M. to be a burglar and had threatened him with bodily harm.
On March 24, 1998, a preliminary hearing was held on the involuntary-commitment petition. The court found from the evidence presented that probable cause existed for committing D.M.; and it ordered him placed on electronic monitoring, pending a final hearing. A second hearing was held on April 24, 1998, but was continued because D.M.'s psychiatrist could not be present. The court released D.M. from electronic monitoring at the request of his parents and denied a motion filed by D.M.'s guardian ad litem to have D.M. declared dependent.[1] A final hearing on the involuntary-commitment petition was held on May 8, 1998, after which the juvenile court committed D.M. to the custody of the Department.
The guardian ad litem filed another motion with the juvenile court on August 21, 1998, asking the court to declare D.M. a "multiple-needs child," as defined by § 12-15-1(19), Ala.Code 1975, and to place him under the supervision of both the Department of Mental Health and Mental Retardation and the Department of Human Resources ("DHR"). DHR responded by asking the court to deny the guardian ad litem's motion. DHR argued that there was no evidence that D.M. was either dependent or neglected and, therefore, that there was no factual basis to support a finding that he was a multiple-needs child. In the alternative, DHR argued that the court should order the Department to locate a residential program that specialized in the treatment of deviant sexual behaviors and should require the Department to pay the expenses associated with D.M.'s placement in that program.
The Department asserts that it was not served with a summons and the involuntary-commitment petition, as required by § 12-15-90(d)(3), Ala.Code 1975. The Department also asserts that it was not served with the guardian ad litem's motion to declare D.M. a multiple-needs child or with DHR's response to that motion. No summons appears in the record on appeal, and neither the guardian ad litem's motion nor DHR's response indicates that these documents were served upon the Department.
At this point, the record becomes confusing. On August 26, 1998, a hearing was held on the motion to declare D.M. a multiple-needs child. The Department asserts that it was not notified of this hearing and was not represented at the hearing. The record does not disclose exactly what took place on August 26, 1998, and we are unable to determine from the record before us whether evidence was presented at the hearing or whether the hearing was limited to the arguments of counsel. The reporter's transcript does not include any testimony from this hearing. Moreover, the portion of the juvenile court's case action summary that is included in the record and that relates to the hearing is illegible. Following the August 26, 1998, hearing, the juvenile court entered an order that states, in pertinent part, as follows:
"Appearing are Leigh Sansone, attorney for the child; Paula Lampkin, guardian ad litem for [the] minor child; Horace O'Neal, attorney for [the] child's parents; Ed Fawwal, attorney for DHR; Lyn Durham, Asst. District Attorney; Jason Springfield, Family Court Mental Health Liaison.
"This cause coming to be heard on Motion To Declare Minor Child Multi Needs filed by Paula Lampkin, child's guardian ad litem. After considering *900 the same, this Court denies said Motion To Declare Minor Child, [D.M.], a multi needs child. This Court further notes that said child has no delinquent cases before this Court and has not been found dependent. This Court further orders that the Department of Mental Health and Mental Retardation is charged with the responsibility of securing a residential program that specializes in the treatment of deviant sexual behaviors for said minor child, [D.M.]. This Court further orders that the Department of Mental Health and Mental Retardation shall be charged with the responsibility of funding such placement."
(Emphasis added.)
The Department did receive the August 26, 1998, order, and on September 9, 1998, it filed a motion to alter, amend, or vacate the order. The only ground asserted in this motion was the Department's claim that Alabama law did not authorize the court to require the Department to pay for D.M.'s placement in a private residential treatment program. The court subsequently denied this motion.
On appeal, the Department argues that it was not served with a summons, as required by Rule 13(A), Ala. R. Juv. P., and that it is not a party to this case. Therefore, the Department argues that the trial court had no jurisdiction to order it to pay for D.M.'s placement in a private residential treatment facility. Moreover, the Department argues that even if it were made a party to this case by virtue of the court's May 8, 1998, order committing D.M. to the custody of the Department, it was not served with the documents leading up to the August 26, 1998, hearing, or given notice of the hearing itself. See, Rule 5(a), Ala. R. Civ. P. (which requires every written motion, except those which may be heard ex parte, to be served upon each party to an action). Therefore, the Department argues that the juvenile court's judgment should be reversed. However, because the Department did not raise this issue before the trial court, it was not preserved for our review. Matter of Brown, 513 So.2d 628 (Ala.Civ.App. 1987); Rule 27, Ala. R. Juv. P.
In Brown, DHR filed a petition to involuntarily commit Brown, who was mentally retarded. After a preliminary and final hearing, the trial court entered an order committing Brown to the custody of the Department. The Department appealed, asserting that it was not given notice of the petition to commit Brown or the subsequent hearing, as required by § 12-15-90(d)(3), Ala.Code 1975. The Department argued that because it was not notified of the hearing, it was not afforded an adequate chance to respond to the petition. In rejecting this argument, we held the following:
"We have examined the record and fail to find any motion made by [the department of] Mental Health to the trial court to set aside the commitment order on the grounds of lack of notice. It is well settled that only issues raised at the trial court level are properly preserved for appeal. Tyler v. Thompson, 50 Ala.App. 24, 276 So.2d 610 (Ala.Civ. App.1973). Consequently, we may not set aside the trial court's order on the ground that Mental Health was not afforded notice pursuant to § 12-15-90(d)(3), Ala.Code 1975."
513 So.2d at 629.
With respect to the lack of service, we note that Rule 27(A), Ala. R. Juv. P., provides that "[a] party not served under Rule 13 may for good cause shown petition the court in writing for a modification of any order, judgment or decree of the court." Here, as in Brown, the appellant failed to raise the issues of lack of service and notice before the trial court. Consequently, it failed to preserve these issues for appellate review.
The Department next argues that the juvenile court had no legal authority to order that its funds be used to pay for D.M.'s placement in a specialized residential treatment facility. We agree.
*901 Section 12-15-71(c)(4), Ala.Code 1975, authorizes the juvenile court to "[m]ake any ... order as the court in its discretion shall deem to be for the welfare and best interests of the child." Section 12-15-70, Ala.Code 1975, provides as follows:
"The juvenile court in its discretion may, either before or after hearing, cause any child within its jurisdiction to be given a physical or mental examination or both by a competent physician, psychiatrist, psychologist or other qualified examiner, under the supervision of a physician, psychiatrist or psychologist who shall certify to the examiner's findings in writing, or an examiner approved by the Department of Mental Health, to be designated by the court having jurisdiction of the child and the physician, psychiatrist, psychologist or mental examiner shall certify to the court the condition in which the child is found.
"If upon such examination or upon procedure as provided in Section 12-15-90, the court has reason to believe that a minor or child is mentally ill or mentally retarded, as defined in this chapter, the court shall proceed in the manner set out in Section 12-15-90.
"Upon examination, if it appears that the child is in need of surgery, medical treatment or care, hospital care or dental care, the court may cause the child to be treated by a competent physician, surgeon or dentist or placed in a public hospital or other institution for training or care or in an approved private home, hospital or institution, which will receive it for like purposes. The expense of such treatment shall be a valid charge against the county unless otherwise provided for.

"The court may grant authority to order emergency medical care to any such person, agency or department charged with the detention, temporary shelter care or other care of a child within its jurisdiction."
(Emphasis added.) The phrase, "unless otherwise provided for" is clarified by § 12-15-10, Ala.Code 1975, which provides:
"All expenses necessary or appropriate to the carrying out of the purposes and intent of this chapter and all expenses of maintenance and care of children that may be incurred by order of the court in carrying out the provisions and intent of this chapter, except costs paid by parents, guardians or trustees, [and] court costs as provided by law ... shall be valid charges and preferred claims against the county and shall be paid by the county treasurer when itemized and sworn to by the creditor or other persons knowing the facts in the case and approved by the court."
(Emphasis added.) See generally, In re McCain, 348 So.2d 780 (Ala.1977).
Our supreme court has held that neither § 12-15-71(c)(4) nor § 12-15-70 authorizes the juvenile court to require a department of the state, as opposed to its counties, to pay for mental health treatment of the child when the parents or other persons legally obligated to care for the child cannot. "Article IV, § 88, of the Alabama Constitution states that `[i]t shall be the duty of the legislature to require the several counties of this state to make adequate provision for the maintenance of the poor.'" Ex parte Department of Human Resources, 620 So.2d 619, 620 (Ala. 1993). See also, Ex parte Department of Mental Health, 511 So.2d 181, 183 (Ala. 1987).
More to the point, it is well settled that juvenile courts have no legal authority to order a state department to use its funds to pay for a child's placement in a private mental health facility. Ex parte Department of Mental Health, 511 So.2d at 183-84 (juvenile court had no authority to commit a child to the custody of the Department and thereafter to place the child in a private psychiatric facility and order the Department to pay all costs of care and treatment); Ex parte State Dep't of Human Resources, 621 So.2d 406 (Ala.Crim. App.1993) (the juvenile court lacked the authority to require DHR to pay for delinquent *902 child's inpatient treatment and care at a private psychiatric facility).
Additionally, by interfering with the Department's exercise of discretion in trying to treat and care for a child committed to its custody, the juvenile court ran afoul of the separation-of-powers doctrine of the Alabama Constitution:
"In the present case the juvenile court instructed the Department that it could not take any action with regard to Morris without its prior written approval. Such a restriction placed on the Department by the court effectively invaded and interfered with the Department's exercise of its discretion in trying to treat and care for Morris after he had been committed to its custody. In other words, the juvenile court did not allow the Department to do its job according to the mandate of the legislature but, instead, proceeded to tell the Department how to deal with Morris. Such action is not within the power of the juvenile court at this stage of the proceedings. We are not to be understood as holding that the juvenile court cannot review actions taken by the Department in the treatment and care of mentally disturbed children committed to its care. All we are saying is that the Department must be given an opportunity to carry out its legislative mandate.
"That part of the juvenile court's order directing the Department not to transfer Morris to another facility or to treat him in a particular way without prior written approval is set aside and held for naught. The judgment of the juvenile court is reversed and the cause is remanded for entry of a judgment consistent with this opinion."
In re Morris, 491 So.2d 244, 246 (Ala.Civ. App.1986) (emphasis added). See also, Ex parte Department of Mental Health, 511 So.2d at 183-84.
Because the juvenile court had no legal authority to order the Department to pay for D.M.'s mental-health care, and because the juvenile court violated the separation-of-powers doctrine of the Alabama Constitution, the cause must be remanded for a new trial.
The guardian ad litem argues that a writ of mandamus is the proper vehicle for review of this case and that this appeal should be dismissed. It is true that orders of the kind entered by the juvenile court in this case are generally subject to mandamus review. Alabama Dep't of Mental Health & Mental Retardation v. State, 718 So.2d 74 (Ala.Civ.App.1998). It is also well settled under Alabama law that mandamus is an extraordinary writ that will not issue if there is an adequate remedy at law. Martin v. Loeb & Co., 349 So.2d 9 (Ala.1977); Alabama Dep't of Mental Health & Mental Retardation v. State, supra.
The Department's motion to alter, amend, or vacate asserts that the juvenile court's order was not authorized by law. Thus, the question whether the juvenile court could properly require the Department to pay for D.M.'s treatment and care in a specialized residential treatment facility is preserved for review on direct appeal. Because an appeal from the juvenile court's judgment provided the Department an adequate remedy at law, the guardian ad litem's argument is without merit. Moreover, even if mandamus is the proper means for obtaining review of the juvenile court's order for the purpose of judicial economy, we would treat the Department's appeal as a petition for a writ of mandamus. Alabama Dep't of Mental Health & Mental Retardation v. State, 718 So.2d at 75; Ex parte Lammon, 688 So.2d 836 (Ala.Civ.App.1996).
Let the judgment be reversed and the case remanded for proceedings consistent with this opinion.
The foregoing opinion was prepared by Sam A. Beatty, Retired Justice, Supreme Court of Alabama, while serving on active-duty status as a judge of this court under the provisions of § 12-18-10(e), Ala.Code 1975.
REVERSED AND REMANDED.
*903 YATES and CRAWLEY, JJ., concur.
ROBERTSON, P.J., and MONROE and THOMPSON, JJ., concur in the result.
NOTES
[1]  The record discloses that on May 7, 1998, D.M.'s guardian ad litem filed a motion in the juvenile court entitled "Petition for Dependency." However, the date stamp appearing on the second page of this motion has been crossed out. Moreover, this motion was denied on April 24, 1998, nearly two weeks before it was purportedly filed.
