
613 P.2d 1016 (1980)
In re the Marriage of Szczepan KOROL, Petitioner and Appellant,
v.
Gwendolyn Locke KOROL, Respondent and Respondent.
No. 79-15.
Supreme Court of Montana.
Submitted April 17, 1980.
Decided July 23, 1980.
*1018 Cameron Ferguson argued, Great Falls, for petitioner and appellant.
Barry T. Olson argued, Great Falls, for respondent and respondent.
HASWELL, Chief Justice.
Appellant Szczepan Korol sought the return of his son to his custody through a petition for habeas corpus. The Cascade County District Court denied his petition and he appeals.
Szczepan and Gwen Korol, the natural parents, obtained a divorce in Cascade County in October, 1976. Mr. Korol was awarded the custody of their child, Stephen, who was born in May, 1977. In March, 1978, Gwen Korol and her mother, Verna Locke, went to Pennsylvania and brought the child back to Great Falls. There is conflicting testimony as to whether the parties had agreed to transfer custody or whether a mere visit was intended. Gwen Korol gave Mr. Korol a stipulation to modify the custody provisions of the divorce decree, but he did not sign it at that time and has not signed it to this date.
It appears that the child resided with Gwen Korol for a short period of time and when she became ill and lost her job in April 1978, Richard and Verna Locke, Gwen's parents, took physical custody. Szczepan Korol requested the return of Stephen after learning in early September, 1978, that the child was in the physical custody of the grandparents.
On September 22, 1978, the Lockes petitioned the District Court for custody of the child. The District Court awarded temporary custody to the Lockes and issued a temporary restraining order which restrained Szczepan Korol from removing the child or disturbing the Lockes. On October 24, 1978, Mr. Korol filed a motion to quash the temporary restraining order and petitioned for a writ of habeas corpus. A hearing was held upon the petition on November 14, 1978. The temporary custody order was dismissed because of the grandparents' failure to comply with the affidavit practice provisions of section 48-340, R.C.M. 1947, now codified in amended form in section 40-4-220, MCA. The only issue presented with regard to the habeas corpus petition was who was entitled to custody of Stephen as between the natural father Szczepan Korol and the maternal grandparents.
Following the hearing, the District Court issued an order on November 15, 1978, which quashed the temporary restraining order, but the grandparents were once again given temporary custody of Stephen. The petition for habeas corpus relief was taken under advisement. On July 9, 1979, the District Court entered an order which found: that a habeas corpus proceeding is appropriate to determine whether custody of a minor should be changed; that the father agreed to surrender custody of the child to the mother in March, 1978; that the father agreed to a modification to change the custody from the custodian to the noncustodian, the mother; that the minor child's present environment will better serve his welfare and best interest; that the custody of the minor child should be "assigned" to the mother until further order; and that the father is financially able to contribute $100 per month in support until the child reaches majority. The petition for habeas corpus was dismissed and custody assigned to the mother.
The following issues have been considered on appeal:
(1) Whether the denial of the natural father's petition for habeas corpus is appealable; and
(2) Whether the District Court abused its discretion in awarding custody to the natural mother, a nonpetitioning party.
The respondent strenuously contends that the District Court's order denying a writ of habeas corpus is not appealable. The basis of this contention is that the court merely awarded temporary relief and that another remedy exists since the grandparents' petition for modification is still pending. Respondent also analogizes the present situation *1019 to the seeking of a writ of habeas corpus in a criminal case in stating that the sole issue is the legality of restraint, and it is therefor not appealable.
In reviewing the District Court's findings and conclusions we find that the court purported to make a final determination of custody. In addition, no petition is pending as a result of section 48-339, R.C.M. 1947. Although this section was amended by the 1979 legislature it was in effect in the following form throughout the District Court proceedings.
"(1) No motion to modify a custody decree may be made earlier that two (2) years after its date, unless the court permits it to be made on the basis of affidavits that there is reason to believe the child's present environment may endanger seriously his physical, mental, moral, or emotional health." (Emphasis added.)
This provision is jurisdictional and requires the District Court to find that the child is seriously endangered if a motion for a change of custody is brought within two years of the entry of a divorce decree. Strouf v. Strouf (1978), Mont., 578 P.2d 746, 35 St.Rep. 626; Olson v. Olson (1978), Mont., 574 P.2d 1004, 35 St.Rep. 175; Schiele v. Sager (1977), 174 Mont. 533, 571 P.2d 1142; Gianotti v. McCracken (1977), 174 Mont. 209, 569 P.2d 929. Olson also reveals that the exception to the two-year limitation is not to be liberally applied.
In our present case the motion to modify custody was brought within the two-year limitation, and the District Court failed to find that the child's health was seriously endangered. Neither does the record reveal any evidence that the child would be endangered in the custody of his father. As a result, there is no jurisdictional basis for the District Court to consider the grandparents' petition for a change of custody.
Since the District Court's order is expressed in terms of a final determination of child custody, this Court is entitled to review the District Court's denial of the father's petition. In addition, a distinction exists concerning appealability between who is entitled to custody in a habeas corpus proceeding and the typical criminal habeas corpus issue of whether the restraint exercised is legal. See State ex rel. Graveley v. District Court (1978), Mont., 582 P.2d 775, 35 St.Rep. 1049.
Turning to the standard of review from habeas corpus, we have held on numerous occasions that the District Court is given wide discretion in habeas corpus proceedings and we will not interfere unless there is a clear abuse of discretion. In re Thompson (1926), 77 Mont. 466, 251 P. 163; Veach v. Veach (1948), 122 Mont. 47, 195 P.2d 697. In the present case we find a clear abuse of discretion.
The sole issue before the District Court was who was entitled to custody as between the natural father and the child's maternal grandparents. This was the issue expressly presented to the court by the parties. The court refused to hear any testimony concerning the best interest of the child. However in its order the District Court, without any evidence before it on the subject, purported to consider the best interests of the child and gave custody to the mother, who had never sought custody. This constitutes an abuse of discretion. The District Court is without authority to award custody to a nonpetitioning party under ordinary circumstances.
As between the natural father and the grandparents, the natural father was entitled to prevail on the basis of his superior rights as a parent as well as his custodial rights under the divorce decree. Absent a finding of abuse, neglect, or unfitness as a parent, a natural parent is entitled to the custody of his child. In the Matter of Doney (1977), 174 Mont. 282, 570 P.2d 575. In addition, the custody provisions of the Uniform Marriage and Divorce Act, sections 40-4-211 through 40-4-221, MCA, are designed to favor custodial continuity over the rights of the competing custodians. This Court has stated that the following policy reasons underlie the changes created by the Act in the child custody area: (1) to preserve the basic policy of custodial continuity; (2) to maximize finality of the custody *1020 provisions of the divorce decree; (3) to prevent "ping-pong" custody litigation; and (4) to implement the principle that finality of the custody decree is of greater importance to the best interest of the child than the determination of which parent should have custody. See Schiele v. Sager, supra; Holm v. Holm (1977), 172 Mont. 81, 560 P.2d 905; Groves v. Groves (1977), 173 Mont. 291, 567 P.2d 459; Easton v. Easton (1978), Mont., 574 P.2d 989, 35 St.Rep. 123. On the basis of this authority, we find that the natural father is entitled to the return of his son.
Although we find several inconsistencies in the District Court's findings and conclusions, we have deemed it unnecessary to address them, since we have held that the custodial parent has superior rights than a nonparent and no jurisdiction to change custody was invoked.
We therefore reverse the District Court's order dismissing the petition and direct the District Court to grant the father's petition for habeas corpus. Nothing in this opinion is to be construed as preventing the mother from bringing a subsequent motion for modification pursuant to section 40-4-219, MCA.
DALY, HARRISON, SHEA and SHEEHY, JJ., concur.
