Bethlehem Area School District (Bethlehem) appeals from the order of the Court of Common Pleas of Northampton County (trial court) ordering Bethlehem to pay the educational component of Plaintiff Community Service Foundation’s • (CSF) treatment program for non-resident students that were ordered into CSF’s day treatment program by the juvenile court.
CSF is a private children and youth agency that operates a day treatment program located in the Bethlehem Area School District. It operates under approval from the Department of Public Welfare to serve children adjudicated either dependent or delinquent by a juvenile court. While located in Bethlehem, it serves children not only from Bethlehem but several other nearby school districts.
CSF’s program runs approximately six hours a day and includes various types of treatment programs as well as educational services. To fund the educational component of its program, CSF sought reimbursement from Bethlehem under Section 1310(b) & (c)1 of the Public School Code of 1949.2 CSF believes that this provision required the school district in which the program was located to pay for the cost of education or provide, educational services and then seek reimbursement for those costs from the school district in which the child resides. Bethlehem refused contending that Section 1810 only establishes an option for school districts in which day treatment centers are located to purchase educational services for juveniles who are not residents of the district and for whom they do not wish to provide educational services directly.
Because of Bethlehem’s refusal to initially pay for educational expenses or provide an education for non-resident children, CSF filed an action in mandamus contending that Bethlehem had a non-diseretionary duty to do so under Section 1310 of the Code. Following a non-jury trial and finding that Section 1310 imposed a clear legal duty on Bethlehem to either educate all children or to purchase educational services for them and then be reimbursed by the child’s home district, the trial court granted CSF’s request for a mandamus and ordered Bethlehem to either pay for the educational services or *884provide them outright for those children ordered into CSF’s program regardless of where the children reside. Bethlehem then filed this instant appeal.3
The sole issue on appeal is whether the trial court erred in interpreting Section 1310 of the School Code so as to make school districts where a' day treatment program is located responsible either to provide or initially pay for the education of non-resident children in an approved day treatment program located within its district.4 In resolving that issue, Bethlehem contends that the trial court erred in holding that Section 1310 imposes such a duty because this provision only gives them the option to purchase educational services for its students and imposes no obligation for the education of non-resident children which it contends is each child’s home district’s responsibility.
In determining whether such a duty is imposed by Section 1310, our duty is to interpret it to effectuate the intention of the legislature behind its enactment. 1 Pa. C.S. § 1921; Cherry v. Pennsylvania Higher Education Assistance Agency, 153 Pa. Cmwlth. 210, 620 A.2d. 687 (1993). Where the language is clear, the language of the statute is controlling and we may not look to legislative intent to hold otherwise. Babb v. Unemployment Compensation Board of Review, 151 Pa.Cmwlth. 190, 616 A.2d 736 (1992). However, where a statute is ambiguous and the language is not clear, the court is to ascertain the General Assembly’s intent by considering the necessity and circumstances surrounding its enactment, the evil to be remedied and the object to be attained. Commonwealth v. PBS Coals, Inc., 677 A.2d 868 (Pa.Cmwlth.1996), petition for allowance of appeal denied, 546 Pa. 684, 686 A.2d 1313 (1996).5 Because Section 1310(b)’s language “may in its discretion purchase education services” can legitimately be interpreted as either party suggests, it is ambiguous and the General Assembly’s intent in enacting the legislation must be discerned.
The trial court, in finding that Bethlehem is initially Hable for the cost of the educational component reasoned that the legislative scheme contained in Section 1310 of the Pub-Hc School Code, showed that the initial cost of educational services should be borne by the school district in which the facihty was located and then be reimbursed by the child’s home district. If it was interpreted as Bethlehem suggested, that would make the reimbursement provisions contained in subsection (c) requiring that the home district reimburse the district in which the facihty was located meaningless. Because the General Assembly would not have reimbursement provisions in this Section unless it intended to impose a duty on a school district where the program was located, something for which it needed to be reimbursed, the only possible interpretation is that it had the obli*885gation to educate the children with the option of purchasing education services for the children that attended the day treatment program.
We agree with the trial court’s analysis and interpretation as it is the only reasonable interpretation that could be given to this provision. Children assigned to day treatment programs, like CSF’s, come from a number of school districts to receive counseling and rehabilitative services as a result of a wide range of emotional, behavioral or psychological problems. When enacting Section 1310, the General Assembly desired that a day treatment program, as the name implies, would be a comprehensive treatment program that would go on throughout the day, melding both educational and rehabilitative services. To have such a program in one school district, the district where the program was located would provide education itself to all children or would purchase educational services for these children from a provider, such as CSF, who specializes in educating these children.
If we were to follow Bethlehem’s interpretation of Section 1310, that it is the only district with authorization to purchase educational services, every other school district would be responsible to educate in their own facilities its resident children. Each child would then go to his or her home school district, then come to the day treatment program for other services. Such a result would not result in a comprehensive program envisioned by Section 1310’s enactment because it would turn the program from a day treatment program into an after school treatment program, with children coming and going throughout the day to attend their home schools.
The intent of the General Assembly that the school district in which the day treatment program is located is to provide services can also be discerned from the Department of Education’s promulgation of 22 Pa.Code § 11.18. It provides that:
(a) The board of school directors in which there is located an agency supervised or licensed shelter, group home, maternity home, residence, facility, orphanage, or other institution for the care or training of children or adolescents, shall admit to the district’s public schools school age children who are living at or assigned to the facility or institution and who are residents of the district or another school district in this Commonwealth.
(b) The board of school directors of a school district in which a day treatment program operated under approval from the Department of Public Welfare by a private children and youth agency is located may purchase educational services for a child referred to the program under section 1310(b) of the Public School Code of 1949.
(c) If the school district of a child living or assigned to a facility or institution, as described in subsection (a) or (b), cannot be determined, but it is decided by the Secretary that the child is a resident of this Commonwealth, the child shall be permitted to attend the public schools of the district... (Emphasis added).
While Section 1310 is ambiguous, the intent expressed and the obligation imposed by this Regulation is not; subsections (a) & (b) read together make it clear that education of all children assigned to a day treatment program is the responsibility of the school district where the program is located.6 It can either educate the children with their own resources or purchase educational services for them, but it is the initial responsibility of the school district where that facility is located to see that the children get educational services.
Because of the language of Section 1310, the interpretation given to it by the implementing regulations, and its goals and objectives, we agree with the trial court that the district in which the day treatment facility is located bears the initial responsibility either of schooling those children in their schools or for the school board to purchase *886the educational component from an agency and then be reimbursed for such costs by the child’s home district. Accordingly, because the School Code places a clear legal duty on the part of Bethlehem, the order of the trial court granting mandamus is affirmed.
ORDER
AND NOW, this 9th day of January, 1998, the order of the trial court at No. 1995-C-7023, dated June 6,1997, is affirmed.
. Section 1310, 24 P.S. § 13-1310 provides, in relevant part:
Notwithstanding anything to the contrary stated within this law, the board of school directors of any school district, in which a day treatment program operated under approval from the Department of Public Welfare by a private children and youth agency is located, may in its discretion purchase educational services for children referred, pursuant to a proceeding under 42 Pa.C.S. Ch. 63 (relating to juvenile matters), to such an agency....
(c) The actual cost, not to exceed the tuition charges of the school district in which such day treatment program is located, shall be borne by the school district of the child’s residence. If the school district of residence of the child cannot be determined, the costs shall be borne by the Department of Education. The department shall effectuate necessary procedures for the transfer of funds from the school district of residence to the school district in which the day treatment program is located. In effectuating the transfer of funds, the department may deduct the appropriate amount from the basic instructional subsidy of any school district which had resident students who were provided educational services by an approved children and youth agency.
. Act of March 10, 1949, P.L. 30, as amended, 24 P.S.§§ 1-101-27-2702.
. This court’s scope of review of a grant or denial of mandamus is limited to determining whether the trial court abused its discretion or committed legal error. Glenn's Dairy, Inc. v. City of Pittsburgh, 675 A.2d 781 (Pa.Cmwlth.1996).
. Mandamus is "an extraordinary writ of common law, designed to compel performance of a ministerial act or mandatory duty where there exists a clear legal right in the plaintiff, a corresponding duty in the defendant, and want of any other adequate and appropriate remedy.” Sanders v. Pennsylvania Board of Probation and Parole, 651 A.2d 663, 666 (Pa.Cmwlth.1994). Mandamus, though, may lie if an action was based upon a mistaken view of the law that the official had discretion to act when he or she actually did not. Weaver v. Pennsylvania Board of Probation and Parole, 688 A.2d 766, 777 (Pa.Cmwlth.1997).
. We agree with the trial court that testimony presented attempting to glean the intent of the General Assembly is irrelevant in interpreting the statute. The Statutory Construction Act specifically authorizes eight separate factors which may be relied upon when ascertaining the intent of a statute’s drafters, none of which include extrinsic evidence offered by those allegedly affected by a statute or ordinance. Among the factors set forth by Section 1921(c) of the Statutory Construction Act, 1 Pa.C.S. § 1921(c), are:
1. The occasion and necessity for the statute.
2. The circumstances under which it was enacted.
3. The mischief to be remedied.
4. The object to be attained;
5. The former law, if any, including other statutes upon the same or similar subjects;
6. The consequences of a particular interpretation;
7. The contemporaneous legislative history;
8. Legislative and administrative interpretations of such statute.
. An agency’s interpretive regulation of a statute that it enforces is entitled to great judicial deference even though the matter ultimately remains a question of law for the courts. Linde Enterprises, Inc. v. Pennsylvania Dept. of Environmental Protection, 692 A.2d 645 (Pa.Cmwlth.1997); Physicians Ins. Co. v. Callahan, 167 Pa.Cmwlth. 485, 648 A.2d 608 (1994).