
750 N.W.2d 531 (2008)
STATE of Iowa, Plaintiff,
v.
IOWA DISTRICT COURT FOR JOHNSON COUNTY, Defendant.
No. 07-0252.
Supreme Court of Iowa.
June 13, 2008.
Thomas J. Miller, Attorney General and Bruce Kempkes, Assistant Attorney General, for plaintiff.
No appearance for defendant.
WIGGINS, Justice.
The issue we must decide is whether the juvenile court can require the department of human services to pay the cost of detaining a juvenile in a detention center while waiting for placement in a group care residential treatment facility. Because the juvenile court did not have the statutory or inherent authority to do so, we sustain the writ of certiorari, and annul the parts of the juvenile court orders requiring the department to pay for the cost of detention.
I. Background Facts and Proceedings.
The State filed a delinquency petition on November 28, 2006, alleging a juvenile committed various criminal offenses. The *533 court held a hearing on the delinquency petition on January 11, 2007. During the hearing the juvenile admitted to the charges. The court placed the juvenile in the custody of the department of human services for placement in a group care residential treatment facility.[1] Because there was a waiting list for placement in such a facility, the juvenile was detained at the Linn County Detention Center. The court also ordered the department to pay any costs or expenses associated with the juvenile's continued placement in the detention center or other shelter while awaiting placement in a group care residential treatment facility.
At the juvenile's first seven-day detention review hearing on January 18, the court heard testimony from a representative of the department regarding the department's group care residential treatment waiting list, which operates on a first-come-first-served basis without consideration of a particular child's need for placement. In its post-hearing order the court found probable cause to believe the juvenile committed delinquent acts; thus, his detention was still warranted, and there was substantial evidence to support the continued removal of the juvenile from his home to avoid imminent risk to the child and for the protection of the community. The court also noted that ordering the juvenile's continued detention in the center was not in the child's best interest, but that the court was unable to exercise its discretion to bypass the waiting list. Additionally, the court found the department was not asserting reasonable efforts to place the juvenile in a proper treatment facility.
The court held another detention review hearing on January 25 during which it heard additional testimony regarding the waiting list. During that hearing a representative of the department opined the juvenile would likely be placed in a group care residential treatment facility within thirty to ninety days of the hearing. Again, the court entered an order continuing the juvenile's detention under the same terms as its prior order.
On January 30 the court was notified the department was able to place the juvenile in the residential treatment program at Woodward Academy. The court approved the placement and ordered custody to remain with the department.
The department filed a petition for writ of certiorari with this court challenging the juvenile court's orders requiring the department to pay any costs associated with the placement of the juvenile in the detention center prior to his placement in a group residential treatment facility. We granted the petition.
II. Issue.
The only issue we must decide is whether the juvenile court orders, requiring the department to pay the delinquent child's detention costs while awaiting placement in a group residential treatment facility, was legal.
III. Scope of Review.
We have "constitutional powers to issue writs to, and exercise supervisory and administrative control over, other judicial tribunals." State v. Davis, 493 N.W.2d 820, 822 (Iowa 1992). A writ of certiorari lies where an inferior tribunal exceeds its proper jurisdiction or otherwise acts illegally. Stream v. Gordy, 716 N.W.2d 187, 190 (Iowa 2006); see also Iowa R. Civ. P. 1.1401 ("A writ of certiorari shall only be granted when specifically authorized by *534 statute; or where an inferior tribunal, board or officer, exercising judicial functions, is alleged to have exceeded proper jurisdiction or otherwise acted illegally."). We have found illegality to exist "when the court's ruling lacks `substantial evidentiary support or when the court has not applied the proper rule of law.'" Bousman v. Iowa Dist. Ct., 630 N.W.2d 789, 794 (Iowa 2001) (quoting Allen v. Iowa Dist. Ct., 582 N.W.2d 506, 508 (Iowa 1998)).
Our scope of review for juvenile court proceedings is de novo. In re D.L.C., 464 N.W.2d 881, 882 (Iowa 1991). However, because "[r]elief through certiorari proceedings is strictly limited to questions of jurisdiction or illegality of the challenged acts," our review is for correction of errors at law. French v. Iowa Dist. Ct., 546 N.W.2d 911, 913 (Iowa 1996).
IV. Analysis.
It is the responsibility of the legislature to enact laws governing the expenditure of state funds. Graham v. Worthington, 259 Iowa 845, 857, 146 N.W.2d 626, 635 (1966). The legislature has fulfilled this responsibility in regard to funding for detention centers. See Iowa Code § 232.142. According to the Code:
1. County boards of supervisors which singly or in conjunction with one or more other counties provide and maintain juvenile detention and juvenile shelter care homes are subject to this section.
2. . . . Expenses for providing and maintaining a multicounty home shall be paid by the counties participating in a manner to be determined by the boards of supervisors.
3. A county or multicounty juvenile detention home approved pursuant to this section shall receive financial aid from the state in a manner approved by the director. Aid paid by the state shall be at least ten percent and not more than fifty percent of the total cost of the establishment, improvements, operation, and maintenance of the home.
. . .
6. A juvenile detention home fund is created in the state treasury under the authority of the department. The fund shall consist of moneys deposited in the fund pursuant to sections 321.218A and 321A.32A. The moneys in the fund shall be used for the costs of the establishment, improvement, operation, and maintenance of county or multicounty juvenile detention homes in accordance with annual appropriations made by the general assembly from the fund for these purposes.

Iowa Code § 232.142(1), (2), (3), (6) (2007) (emphasis added). Section 232.142 clearly places the responsibility for the costs of providing and maintaining juvenile detention centers with the counties. The juvenile court orders requiring the department to pay the cost of keeping the juvenile in the detention center contradict the legislative mandate of section 232.142.
Of course, when a court is acting within its jurisdiction it always has the inherent authority to do what is reasonably necessary for the administration of justice in a case before the court. Schwennen v. Abell, 471 N.W.2d 880, 884 (Iowa 1991). However, the use of inherent authority must be essential to the existence of the court and necessary to the orderly and efficient exercise of the court's jurisdiction. Myers v. Emke, 476 N.W.2d 84, 85 (Iowa 1991). The juvenile court orders requiring the department to pay the cost of the juvenile's detention were neither essential to the existence of the court, nor were they necessary to the orderly and efficient exercise of the court's jurisdiction. See Grant v. Iowa Dist. Ct., 492 N.W.2d 683, 686 *535 (Iowa 1992) (holding the district court lacked inherent authority to order the plaintiffs in a civil action to pay reasonable attorney fees and costs of the guardian ad litem appointed to represent the incarcerated civil defendant).
Therefore, the juvenile court did not have the statutory or inherent authority to order the department to pay the cost of the juvenile's detention.
V. Disposition.
We find the juvenile court acted illegally when it ordered the department of human services to pay the cost of detaining a juvenile in the juvenile detention center because it had no statutory or inherent authority to do so. Accordingly, the writ of certiorari in this court is sustained. We annul the parts of the juvenile court orders requiring the department to pay for the cost of detention.
WRIT SUSTAINED.
All justices concur except BAKER, J., who takes no part.
NOTES
[1]  In its petition for writ of certiorari the State indicated the juvenile was appealing the court's custody order; however, this is not an issue on this petition.
