The opinion of the court was delivered by
Schroeder, J.:This is an appeal in a habeas corpus action by a mother, who was previously given the custody of her four minor children by a foreign divorce decree, from the decision of the district court of Johnson County, Kansas, changing custody of the two oldest children to the father.
The question presented is whether the trial court had jurisdiction to change custody.
The parties formerly lived in Texas where the father was finishing medical training. They had four children who were at the time of trial in this action 11, 8, 6 and 5 years of age. In 1958 the father filed an' action for divorce in Ft. Worth, Texas, and on the 17th day of July of that year the Texas court granted the mother a divorce on her cross petition. It also granted her the custody of the four children. On this point the Texas decree reads:
“(b) That the defendant be, and she is hereby, awarded the care, custody and control of said minor children during 10 months of each year hereafter, with the exception of & of the yearly Christmas holidays, and that the plaintiff be awarded the care, custody and control of said named minor children two months yearly during the summer school vacation, and K of the Christmas holidays each year hereafter.”
The decree further ordered the father to pay child support in the sum of $160 per month until the youngest child shall have reached the age of .18 years, “with the exception that the plaintiff shall not make such payments during the time said children are in his custody.”
*427Following the Texas divorce both parties left that state, the mother went to Maryland and the father to Oklahoma and later to Kansas in Johnson County. At the time of the hearing both parties had remarried, the mother, now Carolyn Tompkins, lives in Bellevue, Washington, near Seattle, and has the two youngest children with her at that place.
On the 22nd day of June, 1960, at the end of the school term, the father assumed his summer custody of the two oldest children, taking them from Maryland where the mother and all of the children then resided, and brought them to Prairie VPlage in Johnson County, Kansas. By the end of the two-month period, during which the father was entitled to the children’s custody under the Texas divorce decree, the mother and her husband had moved to the state of Washington. The father refused to return the two children and enrolled them in school at Prairie Village.
On the 20th day of September, 1960, the mother filed her application for a writ of habeas corpus in which she alleged that she “has requested and demanded respondent obey the order of the court but the respondent has failed, neglected and refused to so comply, is in defiance of the said Texas court order and restrains said children at 5408 West 71st Street, Prairie Village, in Johnson County, Kansas, where respondent resides, all without just cause or pretense of a legal right to do so.” She further alleged:
“That said restraint imposed by the respondent upon the liberties of the said children and the rights of the applicant to their custody is illegal, without right and is in open violation of the terms and provisions of the said order of the Tarrant County, Texas District Court, said order being a valid subsisting and unmodified decree and determination of the custody rights of applicant and respondent and entitled to full faith and credit and enforcement herein.”
Hearing on the mother’s application was set for the 26th day of September, 1960, at which time the father appeared and filed a pleading in the nature of an answer and cross petition designating it “Response to Application for Writ of Habeas Corpus.” In his response the father admitted that he assumed the summer custody of the two oldest children, and that he did not return the said children to the custody of the mother for the reason that it was to the best interests of said minor children to remain in his home. He further alleged:
“4. That the petitioner herein violated the terms and provisions of the decree of divorce entered by the Tarrant County District Court in that she failed and refused to permit respondent to have custody of the minor children *428for the Christmas holiday period of 1959, and further refused to permit respondent to have custody of the two youngest children of petitioner and respondent during the summer of 1960.
“5. That respondent specifically denies that he or anyone in his behalf has placed any restraint upon the liberties of the two children herein involved and further denies that the decree of divorce alluded to in the application herein filed is entitled to full faith and credit or enforcement herein.
“6. For further answer, respondent states that by reason of change in conditions the petitioner herein is not a fit and proper person to have the care, custody and control of the minor children of petitioner and respondent, but that respondent is a fit and proper person to have the care, and control of all of the minor children of said petitioner and respondent.”
He further alleged the two oldest children were residing with and domiciled at his home in Johnson County, Kansas; that the court had jurisdiction of the parties and the two minor children who were residing within the jurisdiction of the court; and that the court had jurisdiction to award him the custody, control and maintenance of said minor children.
In his prayer the father requested the writ of habeas corpus be quashed and denied; that he be given the care, custody and control of the four minor children; and that the mother be required to give the physical custody of the two youngest children to him.
At the trial both parties appeared personally. At that time the mother by motion attempted to challenge the court’s jurisdiction to proceed upon the father’s motion for affirmative relief, and requested the court to confine the issue to the enforcement of the Texas decree. In support of her motion the mother argued that the father had made no attempt to challenge the validity of the Texas decree; that the presence of the two oldest children in Kansas was in the nature of a visitation; and that they were in Kansas at the time of the hearing only because the father had taken it upon himself to extralegally hold the two oldest children in Kansas in violation of the terms of the Texas decree.
The mother’s motion was overruled, and the trial court’s jurisdiction to proceed on the father’s request for affirmative relief was continually challenged at all appropriate times and again upon the motion for a new trial.
The trial court found that the two oldest children were at the time of trial domiciled in Johnson County, Kansas, and that they were within the jurisdiction of the court. It further found that it was in the best interest and welfare of said minor children that their custody be changed from the mother to the father, subject to *429rights of visitation which were specifically spelled out, and further conditioned upon the requirement that the mother give a bond to insure that she would comply with the order of the court. The mother’s writ was denied and she has duly perfected an appeal.
The application for the writ of habeas corpus herein was designed only to test the immediate right to possession of the two oldest minor children held by the appellee. Upon the filing of the action the trial court acquired jurisdiction over the appellee by service of process. He was required to bring the children before the court at the time set for hearing. The parties personally appeared before the court and it had jurisdiction to determine the immediate right to the possession of these two children. (See, Price v. Price, 187 Kan. 292, 356 P. 2d 1013.) The application for the writ itself did not open the door for the modification of any prior award of custody on a showing of changed circumstances.
Inferentially the response filed herein admitted the Texas divorce decree which was incorporated in the application for the writ. The question presented is whether the trial court had jurisdiction to go beyond the application for the writ filed herein to determine the matter of custody raised by the appellee in his response to the application for the writ.
Jurisdiction of the subject matter of child custody depends upon whether or not the children in question were in fact domiciled in the state of Kansas at the time of the commencement of the action below. This the appellee concedes. The matter therefore resolves into an inquiry concerning the legal domicile of the children at the time this action was commenced.
In the field of conflict of laws the perplexing problem of the jurisdiction of various Kansas courts to determine child custody matters has been before the court in a number of recent decisions. Domicile of the child was held to be the controlling jurisdictional factor in Leach v. Leach, 184 Kan. 335, 336 P. 2d 425; Hannon v. Hannon, 186 Kan. 231, 350 P. 2d 26; and Niccum v. Lawrence, 186 Kan. 223, 350 P. 2d 133. These cases follow the older case of Kruse v. Kruse, 150 Kan. 946, 96 P. 2d 849, which adopts and quotes 2 Reale, Conflict of Laws, § 144.3, which reads in part:
“Since custody of a child by one parent carries with it domicil and a domestic status, jurisdiction to give the child to one parent or the other depends in principle on the domicil of the child; and a state which is the temporary residence of the child, not the domicil, cannot confer the right to custody. A *430fortiori a decree for custody rendered in a state where the child is neither resident nor domiciled is void for lack of jurisdiction.
“. . . If after a divorce the party to whom custody was given removes with the child to another state, this would seem to give the second state jurisdiction over the custody, and put an end to the jurisdiction of the first state; for after the divorce each party may change domicil at will, and the child’s domicil changes with that of the parent in whose custody he has been placed. . . (pp. 717, 718.)
The most recent cases in which domicile of the child or children was held to prevail are Robben v. Robben, 188 Kan. 217, 362 P. 2d 29; and Love v. Love, 188 Kan. 185, 360 P. 2d 1061.
Here the mother at the commencement of the action below was domiciled in the state of Washington where she then resided with her husband and the other two minor children not involved in this appeal. At the time the father took the children for the summer custody for the period of sixty days the mother was domiciled in the state of Maryland. The mother was never a resident of Kansas. She came to Kansas for the sole purpose of appearing in court in support of her application for a writ of habeas corpus.
The father in his response to the application for a writ admitted that he did not return the two oldest children to the mother at the end of the sixty-day period authorized by the Texas divorce decree in the summer of 1960. His right to the possession of these children therefore expired, and he was unlawfully and illegally detaining them. When the mother filed her petition she was rightfully entitled to these children under the Texas decree. At that time the childrens domicile was the domicile of the mother. (See, Robben v. Robben, supra; and Niccum v. Lawrence, supra.) Under these circumstances the trial court had no jurisdiction to consider the affirmative relief sought by the father. It should have granted the appellant’s writ upon the force of the Texas decree which disclosed that it had no further jurisdiction to delve into the matter of child custody which the appellee sought to have modified.
The judgment of the lower court is reversed with directions to grant the writ.